💄 UI pass: proxies off by default, picture-only fullscreen, hover submenus, level in the volume slider
Browse files at this commitf178286192fd04f0eb7d0c0cfd3c02b0873e74a4Parent: 77c58ca32 changed files +444 -271
- crates/app/src/export_ui.rs +2 -2
- crates/app/src/keymap.rs +4 -4
- crates/app/src/main.rs +9 -4
- crates/app/src/menus.rs +16 -6
- crates/app/src/player/actions.rs +18 -3
- crates/app/src/player/bins.rs +1 -2
- crates/app/src/player/cards.rs +9 -0
- crates/app/src/player/library.rs +5 -5
- crates/app/src/player/markers.rs +1 -2
- crates/app/src/player/timeline_edit.rs +13 -15
- crates/app/src/render.rs +26 -0
- crates/app/src/tests/left.rs +3 -3
- crates/app/src/tests/media.rs +7 -7
- crates/app/src/tests/nocycle.rs +1 -1
- crates/app/src/timeline_math.rs +11 -0
- crates/app/src/ui/bench_stance/clip.rs +1 -1
- crates/app/src/ui/dock_stance.rs +3 -5
- crates/app/src/ui/overlays.rs +124 -85
- crates/app/src/ui/popup.rs +1 -1
- crates/app/src/ui/settings_stance.rs +4 -4
- crates/app/src/ui/stance.rs +32 -20
- crates/app/src/ui/timeband_stance.rs +46 -70
- crates/app/src/ui/widgets.rs +17 -5
- crates/engine/src/playback.rs +4 -4
- crates/engine/src/project.rs +4 -2
- crates/engine/tests/it/audio_streams.rs +15 -1
- crates/engine/tests/it/bitrate.rs +37 -4
- crates/engine/tests/it/display_unit.rs +7 -3
- crates/engine/tests/it/saveload.rs +2 -6
- crates/engine/tests/it/voice_audio.rs +1 -1
- crates/mcp/src/tools/listen.rs +1 -1
- crates/mcp/src/tools/media.rs +19 -4
crates/app/src/export_ui.rsmodified+2 -2
| @@ -536,7 +536,7 @@ pub(crate) fn encoder_label(seat: EncoderSeat) -> &'static str { | |||
| 536 | pub(crate) fn encoder_note(seat: EncoderSeat) -> &'static str { | 536 | pub(crate) fn encoder_note(seat: EncoderSeat) -> &'static str { |
| 537 | match seat { | 537 | match seat { |
| 538 | EncoderSeat::Auto => "GPU encoder if any", | 538 | EncoderSeat::Auto => "GPU encoder if any", |
| 539 | - EncoderSeat::Hardware => "GPU encoder or refuse", | 539 | + EncoderSeat::Hardware => "GPU encoder or fail", |
| 540 | EncoderSeat::Software => "software encoder, always", | 540 | EncoderSeat::Software => "software encoder, always", |
| 541 | } | 541 | } |
| 542 | } | 542 | } |
| @@ -572,7 +572,7 @@ pub(crate) fn encoder_choices(current: EncoderSeat) -> Vec<ChoiceRow> { | |||
| 572 | #[allow(dead_code)] | 572 | #[allow(dead_code)] |
| 573 | pub(crate) fn av1_hw_warning(format: Format, seat: EncoderSeat) -> Option<&'static str> { | 573 | pub(crate) fn av1_hw_warning(format: Format, seat: EncoderSeat) -> Option<&'static str> { |
| 574 | (seat == EncoderSeat::Hardware && matches!(format, Format::Av1 | Format::Av1Mp4)) | 574 | (seat == EncoderSeat::Hardware && matches!(format, Format::Av1 | Format::Av1Mp4)) |
| 575 | - .then_some("AV1 on the GPU reset this machine's driver once — Software is the safe seat") | 575 | + .then_some("AV1 on the GPU reset this machine's driver once — Software is the safe choice") |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | /// How a rendition is named where a person reads it: the panel button, the | 578 | /// How a rendition is named where a person reads it: the panel button, the |
crates/app/src/keymap.rsmodified+4 -4
| @@ -812,8 +812,8 @@ impl ActionId { | |||
| 812 | ActionId::TransitionPushDown => "Push down", | 812 | ActionId::TransitionPushDown => "Push down", |
| 813 | ActionId::TransitionZoom => "Zoom", | 813 | ActionId::TransitionZoom => "Zoom", |
| 814 | ActionId::Reverse => "Reverse clip", | 814 | ActionId::Reverse => "Reverse clip", |
| 815 | - ActionId::ClipEnabled => "Enabled", | 815 | + ActionId::ClipEnabled => "Clip enabled", |
| 816 | - ActionId::ClipLabel => "Label", | 816 | + ActionId::ClipLabel => "Clip label", |
| 817 | ActionId::NewSolid => "Solid colour", | 817 | ActionId::NewSolid => "Solid colour", |
| 818 | ActionId::NewGradient => "Gradient", | 818 | ActionId::NewGradient => "Gradient", |
| 819 | ActionId::NewCountdown => "Countdown", | 819 | ActionId::NewCountdown => "Countdown", |
| @@ -838,8 +838,8 @@ impl ActionId { | |||
| 838 | ActionId::CompareSide => "Compare: side by side", | 838 | ActionId::CompareSide => "Compare: side by side", |
| 839 | ActionId::AutoColour => "Auto colour", | 839 | ActionId::AutoColour => "Auto colour", |
| 840 | ActionId::SaveLook => "Save colour as look\u{2026}", | 840 | ActionId::SaveLook => "Save colour as look\u{2026}", |
| 841 | - ActionId::ToggleProxies => "Use editing copies", | 841 | + ActionId::ToggleProxies => "Use proxies for playback", |
| 842 | - ActionId::ToggleAutoProxies => "Editing copies on import", | 842 | + ActionId::ToggleAutoProxies => "Make proxies on import", |
| 843 | ActionId::Theme => "Theme…", | 843 | ActionId::Theme => "Theme…", |
| 844 | ActionId::AccentColour => "Accent colour…", | 844 | ActionId::AccentColour => "Accent colour…", |
| 845 | ActionId::Fullscreen => "Fullscreen", | 845 | ActionId::Fullscreen => "Fullscreen", |
crates/app/src/main.rsmodified+9 -4
| @@ -315,9 +315,9 @@ struct Player { | |||
| 315 | ledger_readout: Rc<Cell<Bounds<Pixels>>>, | 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. | 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>>>, | 317 | toast_text: Rc<Cell<Bounds<Pixels>>>, |
| 318 | - /// The clip menu's Adjust row has the pointer: the 150 ms timer opens the | 318 | + /// The clip menu's submenu row (Adjust, Compound, Label or Fit) the pointer is on, if any: |
| 319 | - /// submenu only if it still does. | 319 | + /// its 150 ms timer opens that submenu only if it is still the one under the pointer. |
| 320 | - adjust_hot: bool, | 320 | + sub_hot: Sub, |
| 321 | /// Where the pointer came onto the Adjust row, and the submenu's near edge | 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" | 322 | /// `(x, top, bottom)` (written while drawing): together the "safe triangle" |
| 323 | /// a diagonal move toward the submenu may cross without closing it. | 323 | /// a diagonal move toward the submenu may cross without closing it. |
| @@ -1203,6 +1203,10 @@ struct Player { | |||
| 1203 | /// closed) cannot have the new session's frame written under the old name | 1203 | /// closed) cannot have the new session's frame written under the old name |
| 1204 | /// ([`Player::session_swapped`]). | 1204 | /// ([`Player::session_swapped`]). |
| 1205 | shot_pending: Option<(u64, String, String)>, | 1205 | shot_pending: Option<(u64, String, String)>, |
| 1206 | + /// The viewer size a playing picture was last asked for, and when it first | ||
| 1207 | + /// asked for it: a resize is applied only once it has held still for | ||
| 1208 | + /// `VIEW_SETTLE` ([`Player::push_view_size`]). `None` while paused. | ||
| 1209 | + view_seen: Option<((u32, u32), Instant)>, | ||
| 1206 | /// The active session's identity, for the above: bumped by every door that | 1210 | /// The active session's identity, for the above: bumped by every door that |
| 1207 | /// swaps `session` or `preview_session`. | 1211 | /// swaps `session` or `preview_session`. |
| 1208 | session_gen: u64, | 1212 | session_gen: u64, |
| @@ -1534,7 +1538,7 @@ fn main() { | |||
| 1534 | menu_sub2: None, | 1538 | menu_sub2: None, |
| 1535 | ledger_readout: Rc::default(), | 1539 | ledger_readout: Rc::default(), |
| 1536 | toast_text: Rc::default(), | 1540 | toast_text: Rc::default(), |
| 1537 | - adjust_hot: false, | 1541 | + sub_hot: Sub::Closed, |
| 1538 | adjust_aim: None, | 1542 | adjust_aim: None, |
| 1539 | adjust_sub: Cell::new(None), | 1543 | adjust_sub: Cell::new(None), |
| 1540 | picker: None, | 1544 | picker: None, |
| @@ -1770,6 +1774,7 @@ fn main() { | |||
| 1770 | viz_wheel: Rc::default(), | 1774 | viz_wheel: Rc::default(), |
| 1771 | picture_box: Rc::default(), | 1775 | picture_box: Rc::default(), |
| 1772 | shot_pending: None, | 1776 | shot_pending: None, |
| 1777 | + view_seen: None, | ||
| 1773 | session_gen: 0, | 1778 | session_gen: 0, |
| 1774 | // Nothing heard yet: the first pump seeds it off the session | 1779 | // Nothing heard yet: the first pump seeds it off the session |
| 1775 | // it serves. | 1780 | // it serves. |
crates/app/src/menus.rsmodified+16 -6
| @@ -56,11 +56,22 @@ pub(crate) struct ContextMenu { | |||
| 56 | pub(crate) on: MenuOn, | 56 | pub(crate) on: MenuOn, |
| 57 | pub(crate) at: Point<Pixels>, | 57 | pub(crate) at: Point<Pixels>, |
| 58 | pub(crate) details: bool, | 58 | pub(crate) details: bool, |
| 59 | - /// A submenu is out beside the plate: "Adjust" (the card openers), or "Compound" when | 59 | + /// The submenu out beside the plate, if any. One at a time. |
| 60 | - /// [`ContextMenu::compound`] says so. One at a time. | 60 | + pub(crate) sub: Sub, |
| 61 | - pub(crate) adjust: bool, | 61 | +} |
| 62 | - /// The submenu that is out is "Compound" (nest, break apart, open), not "Adjust". | 62 | + |
| 63 | - pub(crate) compound: bool, | 63 | +/// Which submenu of a clip menu is out beside the plate. |
| 64 | +#[derive(Clone, Copy, PartialEq, Eq, Debug)] | ||
| 65 | +pub(crate) enum Sub { | ||
| 66 | + Closed, | ||
| 67 | + /// The card openers. | ||
| 68 | + Adjust, | ||
| 69 | + /// Nest, break apart, open, flatten. | ||
| 70 | + Compound, | ||
| 71 | + /// The colour list of the clip. | ||
| 72 | + Label, | ||
| 73 | + /// The fit policies of the clip. | ||
| 74 | + Fit, | ||
| 64 | } | 75 | } |
| 65 | 76 | ||
| 66 | /// An open library menu: which row it was opened on -- the file and the stream, | 77 | /// An open library menu: which row it was opened on -- the file and the stream, |
| @@ -535,7 +546,6 @@ pub(crate) fn adjust_item(action: ActionId) -> bool { | |||
| 535 | | ActionId::Reframe | 546 | | ActionId::Reframe |
| 536 | | ActionId::TrackMask | 547 | | ActionId::TrackMask |
| 537 | | ActionId::Speed | 548 | | ActionId::Speed |
| 538 | - | ActionId::Fit | ||
| 539 | ) | 549 | ) |
| 540 | } | 550 | } |
| 541 | 551 | ||
crates/app/src/player/actions.rsmodified+18 -3
| @@ -11,8 +11,19 @@ use crate::*; | |||
| 11 | pub(crate) fn step_name(action: ActionId) -> Option<&'static str> { | 11 | pub(crate) fn step_name(action: ActionId) -> Option<&'static str> { |
| 12 | let name = match action { | 12 | let name = match action { |
| 13 | ActionId::Undo | ActionId::Redo => return None, | 13 | ActionId::Undo | ActionId::Redo => return None, |
| 14 | - ActionId::ClipEnabled => "Clip enabled", | 14 | + ActionId::ClipEnabled => "Enable/disable clip", |
| 15 | - ActionId::ClipLabel => "Clip label", | 15 | + ActionId::ClipLabel => "Set clip label", |
| 16 | + ActionId::NewSolid => "Add solid colour", | ||
| 17 | + ActionId::NewGradient => "Add gradient", | ||
| 18 | + ActionId::NewCountdown => "Add countdown", | ||
| 19 | + ActionId::NewBars => "Add colour bars", | ||
| 20 | + ActionId::NewTone => "Add tone", | ||
| 21 | + ActionId::NewBarsAndTone => "Add bars and tone", | ||
| 22 | + ActionId::NewAdjustment => "Add adjustment layer", | ||
| 23 | + ActionId::NewRectangle => "Add rectangle shape", | ||
| 24 | + ActionId::NewEllipse => "Add ellipse shape", | ||
| 25 | + ActionId::NewLine => "Add line shape", | ||
| 26 | + ActionId::NewArrow => "Add arrow shape", | ||
| 16 | _ => action.label().trim_end_matches('\u{2026}'), | 27 | _ => action.label().trim_end_matches('\u{2026}'), |
| 17 | }; | 28 | }; |
| 18 | (name.chars().count() < 30).then_some(name) | 29 | (name.chars().count() < 30).then_some(name) |
| @@ -312,6 +323,9 @@ impl Player { | |||
| 312 | // claimed the key, so it empties every selection the timeline | 323 | // claimed the key, so it empties every selection the timeline |
| 313 | // holds -- clips, a picked gap, a title and a caption -- and the | 324 | // holds -- clips, a picked gap, a title and a caption -- and the |
| 314 | // Clip tab goes back to what it shows with nothing picked. | 325 | // Clip tab goes back to what it shows with nothing picked. |
| 326 | + // In player fullscreen Escape leaves it first, the way every video player does; the | ||
| 327 | + // picks stay where they are until the next Escape. | ||
| 328 | + ActionId::Deselect if self.player_fullscreen => self.run_action(ActionId::Fullscreen, window, cx), | ||
| 315 | ActionId::Deselect => self.clear_picks(cx), | 329 | ActionId::Deselect => self.clear_picks(cx), |
| 316 | // A picked gap is what Delete closes (DESIGN §7); a clip mark or | 330 | // 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. | 331 | // nothing at all falls through to the clip path as before. |
| @@ -1644,7 +1658,8 @@ mod tests { | |||
| 1644 | assert_eq!(step_name(ActionId::Color), Some("Colour")); | 1658 | assert_eq!(step_name(ActionId::Color), Some("Colour")); |
| 1645 | assert_eq!(step_name(ActionId::AddMarker), Some("Add marker")); | 1659 | assert_eq!(step_name(ActionId::AddMarker), Some("Add marker")); |
| 1646 | assert_eq!(step_name(ActionId::Delete), Some("Delete")); | 1660 | assert_eq!(step_name(ActionId::Delete), Some("Delete")); |
| 1647 | - assert_eq!(step_name(ActionId::ClipEnabled), Some("Clip enabled")); | 1661 | + assert_eq!(step_name(ActionId::ClipEnabled), Some("Enable/disable clip")); |
| 1662 | + assert_eq!(step_name(ActionId::NewTone), Some("Add tone")); | ||
| 1648 | assert_eq!(step_name(ActionId::Undo), None); | 1663 | assert_eq!(step_name(ActionId::Undo), None); |
| 1649 | assert_eq!(step_name(ActionId::Redo), None); | 1664 | assert_eq!(step_name(ActionId::Redo), None); |
| 1650 | for action in ActionId::ALL { | 1665 | for action in ActionId::ALL { |
crates/app/src/player/bins.rsmodified+1 -2
| @@ -154,8 +154,7 @@ impl Player { | |||
| 154 | on: MenuOn::Bin, | 154 | on: MenuOn::Bin, |
| 155 | at, | 155 | at, |
| 156 | details: false, | 156 | details: false, |
| 157 | - adjust: false, | 157 | + sub: Sub::Closed, |
| 158 | - compound: false, | ||
| 159 | }); | 158 | }); |
| 160 | cx.notify(); | 159 | cx.notify(); |
| 161 | } | 160 | } |
crates/app/src/player/cards.rsmodified+9 -0
| @@ -3789,6 +3789,15 @@ impl Player { | |||
| 3789 | } | 3789 | } |
| 3790 | _ => self.selected.anchor(), | 3790 | _ => self.selected.anchor(), |
| 3791 | }; | 3791 | }; |
| 3792 | + // A video clip's sound is its linked audio half, so Alt+4 on a picked film opens on that. | ||
| 3793 | + let anchor = match anchor { | ||
| 3794 | + Some((lane, idx)) if lane.kind == LaneKind::Video => self | ||
| 3795 | + .linked_partners((lane, idx)) | ||
| 3796 | + .into_iter() | ||
| 3797 | + .find(|(l, _)| l.kind == LaneKind::Audio) | ||
| 3798 | + .or(anchor), | ||
| 3799 | + _ => anchor, | ||
| 3800 | + }; | ||
| 3792 | let refusal = match (anchor, &self.session) { | 3801 | let refusal = match (anchor, &self.session) { |
| 3793 | (_, None) => Some("No timeline — no file open".to_string()), | 3802 | (_, None) => Some("No timeline — no file open".to_string()), |
| 3794 | (None, _) => Some(format!( | 3803 | (None, _) => Some(format!( |
crates/app/src/player/library.rsmodified+5 -5
| @@ -72,13 +72,13 @@ pub(crate) fn auto_proxies_pref_path() -> PathBuf { | |||
| 72 | crate::keymap::Keymap::config_path().with_file_name("auto-proxies") | 72 | crate::keymap::Keymap::config_path().with_file_name("auto-proxies") |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | -/// `On` unless the file says `off`; missing, unreadable or garbled all read as | 75 | +/// `Off` unless the file says `on`; missing, unreadable or garbled all read as |
| 76 | -/// `On`, the same default the field has always started at -- a preference | 76 | +/// `Off`, the same as [`load_proxies_pref`] -- a preference file is not the |
| 77 | -/// file is not the user's work, so a bad one is worth no message at startup. | 77 | +/// user's work, so a bad one is worth no message at startup. |
| 78 | pub(crate) fn load_auto_proxies_pref() -> bool { | 78 | pub(crate) fn load_auto_proxies_pref() -> bool { |
| 79 | match std::fs::read_to_string(auto_proxies_pref_path()) { | 79 | match std::fs::read_to_string(auto_proxies_pref_path()) { |
| 80 | - Ok(text) => text.trim() != "off", | 80 | + Ok(text) => text.trim() == "on", |
| 81 | - Err(_) => true, | 81 | + Err(_) => false, |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
crates/app/src/player/markers.rsmodified+1 -2
| @@ -183,8 +183,7 @@ impl Player { | |||
| 183 | on: MenuOn::Marker, | 183 | on: MenuOn::Marker, |
| 184 | at, | 184 | at, |
| 185 | details: false, | 185 | details: false, |
| 186 | - adjust: false, | 186 | + sub: Sub::Closed, |
| 187 | - compound: false, | ||
| 188 | }); | 187 | }); |
| 189 | cx.notify(); | 188 | cx.notify(); |
| 190 | } | 189 | } |
crates/app/src/player/timeline_edit.rsmodified+13 -15
| @@ -1555,7 +1555,12 @@ impl Player { | |||
| 1555 | if !self.menu_allowed() { | 1555 | if !self.menu_allowed() { |
| 1556 | return; | 1556 | return; |
| 1557 | } | 1557 | } |
| 1558 | - if !self.selected.contains((lane, idx)) { | 1558 | + if self.selected.contains((lane, idx)) { |
| 1559 | + // Kept, but this clip becomes the anchor: Equalizer, Speed and the other | ||
| 1560 | + // one-clip items read the anchor, and inside a linked pair it could be the | ||
| 1561 | + // other half -- the video one, which the equalizer then refused. | ||
| 1562 | + self.selected.promote((lane, idx)); | ||
| 1563 | + } else { | ||
| 1559 | self.select((lane, idx), cx); | 1564 | self.select((lane, idx), cx); |
| 1560 | } | 1565 | } |
| 1561 | self.context_menu = Some(ContextMenu { | 1566 | self.context_menu = Some(ContextMenu { |
| @@ -1563,8 +1568,7 @@ impl Player { | |||
| 1563 | on: MenuOn::Clip(idx), | 1568 | on: MenuOn::Clip(idx), |
| 1564 | at, | 1569 | at, |
| 1565 | details: false, | 1570 | details: false, |
| 1566 | - adjust: false, | 1571 | + sub: Sub::Closed, |
| 1567 | - compound: false, | ||
| 1568 | }); | 1572 | }); |
| 1569 | cx.notify(); | 1573 | cx.notify(); |
| 1570 | } | 1574 | } |
| @@ -1588,8 +1592,7 @@ impl Player { | |||
| 1588 | on: MenuOn::Gap(start, frames), | 1592 | on: MenuOn::Gap(start, frames), |
| 1589 | at, | 1593 | at, |
| 1590 | details: false, | 1594 | details: false, |
| 1591 | - adjust: false, | 1595 | + sub: Sub::Closed, |
| 1592 | - compound: false, | ||
| 1593 | }); | 1596 | }); |
| 1594 | cx.notify(); | 1597 | cx.notify(); |
| 1595 | } | 1598 | } |
| @@ -1613,8 +1616,7 @@ impl Player { | |||
| 1613 | on: MenuOn::Bench, | 1616 | on: MenuOn::Bench, |
| 1614 | at, | 1617 | at, |
| 1615 | details: false, | 1618 | details: false, |
| 1616 | - adjust: false, | 1619 | + sub: Sub::Closed, |
| 1617 | - compound: false, | ||
| 1618 | }); | 1620 | }); |
| 1619 | cx.notify(); | 1621 | cx.notify(); |
| 1620 | } | 1622 | } |
| @@ -1633,8 +1635,7 @@ impl Player { | |||
| 1633 | on: MenuOn::Empty, | 1635 | on: MenuOn::Empty, |
| 1634 | at, | 1636 | at, |
| 1635 | details: false, | 1637 | details: false, |
| 1636 | - adjust: false, | 1638 | + sub: Sub::Closed, |
| 1637 | - compound: false, | ||
| 1638 | }); | 1639 | }); |
| 1639 | cx.notify(); | 1640 | cx.notify(); |
| 1640 | } | 1641 | } |
| @@ -1655,8 +1656,7 @@ impl Player { | |||
| 1655 | on: MenuOn::Viewer, | 1656 | on: MenuOn::Viewer, |
| 1656 | at, | 1657 | at, |
| 1657 | details: false, | 1658 | details: false, |
| 1658 | - adjust: false, | 1659 | + sub: Sub::Closed, |
| 1659 | - compound: false, | ||
| 1660 | }); | 1660 | }); |
| 1661 | cx.notify(); | 1661 | cx.notify(); |
| 1662 | } | 1662 | } |
| @@ -1676,8 +1676,7 @@ impl Player { | |||
| 1676 | on: MenuOn::SeqTab, | 1676 | on: MenuOn::SeqTab, |
| 1677 | at, | 1677 | at, |
| 1678 | details: false, | 1678 | details: false, |
| 1679 | - adjust: false, | 1679 | + sub: Sub::Closed, |
| 1680 | - compound: false, | ||
| 1681 | }); | 1680 | }); |
| 1682 | cx.notify(); | 1681 | cx.notify(); |
| 1683 | } | 1682 | } |
| @@ -1695,8 +1694,7 @@ impl Player { | |||
| 1695 | on: MenuOn::Head, | 1694 | on: MenuOn::Head, |
| 1696 | at, | 1695 | at, |
| 1697 | details: false, | 1696 | details: false, |
| 1698 | - adjust: false, | 1697 | + sub: Sub::Closed, |
| 1699 | - compound: false, | ||
| 1700 | }); | 1698 | }); |
| 1701 | cx.notify(); | 1699 | cx.notify(); |
| 1702 | } | 1700 | } |
crates/app/src/render.rsmodified+26 -0
| @@ -181,6 +181,12 @@ impl Player { | |||
| 181 | } | 181 | } |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | +/// How long a viewer size must hold still while playing before the picture is | ||
| 185 | +/// restarted for it. Each restart stalls the picture until the new stream | ||
| 186 | +/// refills, so a window being dragged (a step every few pixels) is applied | ||
| 187 | +/// once the drag rests instead of on every step. | ||
| 188 | +const VIEW_SETTLE: std::time::Duration = std::time::Duration::from_millis(200); | ||
| 189 | + | ||
| 184 | impl Player { | 190 | impl Player { |
| 185 | /// Tells the active session where the picture actually lands, in device | 191 | /// Tells the active session where the picture actually lands, in device |
| 186 | /// pixels, so its seats can paint at that size instead of the project's | 192 | /// pixels, so its seats can paint at that size instead of the project's |
| @@ -223,6 +229,26 @@ impl Player { | |||
| 223 | let w = (f32::from(fitted.size.width) * scale).round() as u32; | 229 | let w = (f32::from(fitted.size.width) * scale).round() as u32; |
| 224 | let h = (f32::from(fitted.size.height) * scale).round() as u32; | 230 | let h = (f32::from(fitted.size.height) * scale).round() as u32; |
| 225 | let (w, h) = self.viewer_target((w, h), native, playing); | 231 | let (w, h) = self.viewer_target((w, h), native, playing); |
| 232 | + // Playing: a size that is still moving is held back until it has rested | ||
| 233 | + // for VIEW_SETTLE, since every apply restarts the picture. Paused, a frame | ||
| 234 | + // is cheap and must be sharp, so the size is applied at once. | ||
| 235 | + let settled = if !playing { | ||
| 236 | + self.view_seen = None; | ||
| 237 | + true | ||
| 238 | + } else { | ||
| 239 | + match self.view_seen { | ||
| 240 | + Some((size, since)) if size == (w, h) => since.elapsed() >= VIEW_SETTLE, | ||
| 241 | + _ => { | ||
| 242 | + self.view_seen = Some(((w, h), Instant::now())); | ||
| 243 | + false | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + }; | ||
| 247 | + if !settled { | ||
| 248 | + // The loop keeps turning while playing; asked again in case it does not. | ||
| 249 | + window.request_animation_frame(); | ||
| 250 | + return; | ||
| 251 | + } | ||
| 226 | let Some(session) = self.active_session_mut() else { | 252 | let Some(session) = self.active_session_mut() else { |
| 227 | return; | 253 | return; |
| 228 | }; | 254 | }; |
crates/app/src/tests/left.rsmodified+3 -3
| @@ -12,10 +12,10 @@ fn eq_numbers_read_the_way_the_card_shows_them() { | |||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | #[test] | 14 | #[test] |
| 15 | -fn the_library_menu_says_editing_copy_not_proxy() { | 15 | +fn the_proxy_switches_say_proxy_so_a_search_finds_them() { |
| 16 | assert_eq!(RowItem::Proxy.label(), "Make editing copy"); | 16 | assert_eq!(RowItem::Proxy.label(), "Make editing copy"); |
| 17 | - assert!(!keymap::ActionId::ToggleProxies.label().to_lowercase().contains("proxies")); | 17 | + assert!(keymap::ActionId::ToggleProxies.label().to_lowercase().contains("proxies")); |
| 18 | - assert!(!keymap::ActionId::ToggleAutoProxies.label().to_lowercase().contains("proxies")); | 18 | + assert!(keymap::ActionId::ToggleAutoProxies.label().to_lowercase().contains("proxies")); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[test] | 21 | #[test] |
crates/app/src/tests/media.rsmodified+7 -7
| @@ -1296,9 +1296,9 @@ fn the_subtitle_card_sizes_outlines_and_offsets_are_bounded() { | |||
| 1296 | /// call the same claim it makes about Proxies: a project's own line always | 1296 | /// call the same claim it makes about Proxies: a project's own line always |
| 1297 | /// beats this one once one is open ([`engine::edith::Document::auto_proxy`]), | 1297 | /// beats this one once one is open ([`engine::edith::Document::auto_proxy`]), |
| 1298 | /// but with nothing open (or nothing saved since the flip) this is what a | 1298 | /// but with nothing open (or nothing saved since the flip) this is what a |
| 1299 | -/// relaunch reads instead of the field's hardcoded `true`. | 1299 | +/// relaunch reads instead of the hardcoded Off. |
| 1300 | #[test] | 1300 | #[test] |
| 1301 | -fn the_auto_proxies_default_round_trips_through_its_own_config_file_or_falls_back_to_on() { | 1301 | +fn the_auto_proxies_default_round_trips_through_its_own_config_file_or_falls_back_to_off() { |
| 1302 | let _config_env = config_env_lock(); | 1302 | let _config_env = config_env_lock(); |
| 1303 | 1303 | ||
| 1304 | let dir = std::env::temp_dir().join(format!( | 1304 | let dir = std::env::temp_dir().join(format!( |
| @@ -1314,8 +1314,8 @@ fn the_auto_proxies_default_round_trips_through_its_own_config_file_or_falls_bac | |||
| 1314 | // path. | 1314 | // path. |
| 1315 | crate::keymap::set_test_config_home(Some(dir.clone())); | 1315 | crate::keymap::set_test_config_home(Some(dir.clone())); |
| 1316 | 1316 | ||
| 1317 | - // Nothing written yet: On, the field's own long-standing default. | 1317 | + // Nothing written yet: Off, the default. |
| 1318 | - assert!(load_auto_proxies_pref(), "a missing file must read as On"); | 1318 | + assert!(!load_auto_proxies_pref(), "a missing file must read as Off"); |
| 1319 | 1319 | ||
| 1320 | save_auto_proxies_pref(false).unwrap(); | 1320 | save_auto_proxies_pref(false).unwrap(); |
| 1321 | assert!(!load_auto_proxies_pref(), "off must round-trip"); | 1321 | assert!(!load_auto_proxies_pref(), "off must round-trip"); |
| @@ -1326,12 +1326,12 @@ fn the_auto_proxies_default_round_trips_through_its_own_config_file_or_falls_bac | |||
| 1326 | "on must round-trip too, not just off" | 1326 | "on must round-trip too, not just off" |
| 1327 | ); | 1327 | ); |
| 1328 | 1328 | ||
| 1329 | - // Garbled bytes -- a stray edit, or a future dialect -- read as On rather | 1329 | + // Garbled bytes -- a stray edit, or a future dialect -- read as Off rather |
| 1330 | // than failing a startup on someone else's edit of the file. | 1330 | // than failing a startup on someone else's edit of the file. |
| 1331 | std::fs::write(auto_proxies_pref_path(), "not on or off\n").unwrap(); | 1331 | std::fs::write(auto_proxies_pref_path(), "not on or off\n").unwrap(); |
| 1332 | assert!( | 1332 | assert!( |
| 1333 | - load_auto_proxies_pref(), | 1333 | + !load_auto_proxies_pref(), |
| 1334 | - "unreadable content must fall back to On" | 1334 | + "unreadable content must fall back to Off" |
| 1335 | ); | 1335 | ); |
| 1336 | 1336 | ||
| 1337 | crate::keymap::set_test_config_home(None); | 1337 | crate::keymap::set_test_config_home(None); |
crates/app/src/tests/nocycle.rsmodified+1 -1
| @@ -58,7 +58,7 @@ fn the_rows_that_became_lists_say_so_in_their_labels() { | |||
| 58 | assert_eq!(ActionId::Fit.label(), "Fit to frame…"); | 58 | assert_eq!(ActionId::Fit.label(), "Fit to frame…"); |
| 59 | assert_eq!(ActionId::KeyEasing.label(), "Key easing…"); | 59 | assert_eq!(ActionId::KeyEasing.label(), "Key easing…"); |
| 60 | assert_eq!(ActionId::SpeedRampFastSlowFast.label(), "Speed ramp fast-slow-fast"); | 60 | assert_eq!(ActionId::SpeedRampFastSlowFast.label(), "Speed ramp fast-slow-fast"); |
| 61 | - assert_eq!(ActionId::ToggleProxies.label(), "Use editing copies"); | 61 | + assert_eq!(ActionId::ToggleProxies.label(), "Use proxies for playback"); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | #[test] | 64 | #[test] |
crates/app/src/timeline_math.rsmodified+11 -0
| @@ -141,6 +141,17 @@ impl Selection { | |||
| 141 | self.picks.last().copied() | 141 | self.picks.last().copied() |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | + /// Moves `pick`, already one of the selection's, to the end, so it becomes | ||
| 145 | + /// the [`Self::anchor`] while every other pick stays: a right-click inside a | ||
| 146 | + /// selection keeps it, and the menu's one-clip items still act on the clip | ||
| 147 | + /// the hand named. | ||
| 148 | + pub(crate) fn promote(&mut self, pick: (Lane, usize)) { | ||
| 149 | + if let Some(at) = self.picks.iter().position(|p| *p == pick) { | ||
| 150 | + let pick = self.picks.remove(at); | ||
| 151 | + self.picks.push(pick); | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + | ||
| 144 | /// Whether `pick` is one of the selection's -- the question a right-click | 155 | /// Whether `pick` is one of the selection's -- the question a right-click |
| 145 | /// asks before it decides whether the menu is about the selection or | 156 | /// asks before it decides whether the menu is about the selection or |
| 146 | /// about the clip under it. | 157 | /// about the clip under it. |
crates/app/src/ui/bench_stance/clip.rsmodified+1 -1
| @@ -1217,7 +1217,7 @@ pub(crate) fn hover_hint_text(zone: HoverZone, shift: bool, alt: bool) -> &'stat | |||
| 1217 | "Shift-drag: change which part of the clip plays \u{00b7} add Alt to slide" | 1217 | "Shift-drag: change which part of the clip plays \u{00b7} add Alt to slide" |
| 1218 | } | 1218 | } |
| 1219 | (HoverZone::Body, true, true) => { | 1219 | (HoverZone::Body, true, true) => { |
| 1220 | - "Shift+Alt-drag: slide, neighbours give and take" | 1220 | + "Shift+Alt-drag: slide; neighbouring clips absorb the change" |
| 1221 | } | 1221 | } |
| 1222 | (HoverZone::Body, false, true) => "Alt-drag: move with snapping off", | 1222 | (HoverZone::Body, false, true) => "Alt-drag: move with snapping off", |
| 1223 | } | 1223 | } |
crates/app/src/ui/dock_stance.rsmodified+3 -5
| @@ -1737,8 +1737,7 @@ fn opens_dock_menu( | |||
| 1737 | on: MenuOn::Dock, | 1737 | on: MenuOn::Dock, |
| 1738 | at: event.position, | 1738 | at: event.position, |
| 1739 | details: false, | 1739 | details: false, |
| 1740 | - adjust: false, | 1740 | + sub: Sub::Closed, |
| 1741 | - compound: false, | ||
| 1742 | }); | 1741 | }); |
| 1743 | cx.notify(); | 1742 | cx.notify(); |
| 1744 | }) | 1743 | }) |
| @@ -2168,8 +2167,7 @@ fn sources_tab( | |||
| 2168 | on: MenuOn::Dock, | 2167 | on: MenuOn::Dock, |
| 2169 | at, | 2168 | at, |
| 2170 | details: false, | 2169 | details: false, |
| 2171 | - adjust: false, | 2170 | + sub: Sub::Closed, |
| 2172 | - compound: false, | ||
| 2173 | }); | 2171 | }); |
| 2174 | cx.notify(); | 2172 | cx.notify(); |
| 2175 | })), | 2173 | })), |
| @@ -2186,7 +2184,7 @@ fn sources_tab( | |||
| 2186 | div() | 2184 | div() |
| 2187 | .id("dock-which") | 2185 | .id("dock-which") |
| 2188 | .flex_none() | 2186 | .flex_none() |
| 2189 | - .tooltip(crate::ui::widgets::tip_hover("Which media", "", None)) | 2187 | + .tooltip(crate::ui::widgets::tip_hover("Show all media or favourites only", "", None)) |
| 2190 | .child(kit::segmented( | 2188 | .child(kit::segmented( |
| 2191 | "dock-which-seg", | 2189 | "dock-which-seg", |
| 2192 | &[Segment::text("All"), Segment::text("Favourites")], | 2190 | &[Segment::text("All"), Segment::text("Favourites")], |
crates/app/src/ui/overlays.rsmodified+124 -85
| @@ -170,6 +170,9 @@ impl Player { | |||
| 170 | let mut sub_rows: Vec<AnyElement> = Vec::new(); | 170 | let mut sub_rows: Vec<AnyElement> = Vec::new(); |
| 171 | let mut sub_measure: Vec<(String, String)> = Vec::new(); | 171 | let mut sub_measure: Vec<(String, String)> = Vec::new(); |
| 172 | let mut adjust_at: Option<usize> = None; | 172 | let mut adjust_at: Option<usize> = None; |
| 173 | + // Where the Clip label and Fit to frame rows sit, each opening its own submenu. | ||
| 174 | + let mut label_at: Option<usize> = None; | ||
| 175 | + let mut fit_at: Option<usize> = None; | ||
| 173 | let mut comp_rows: Vec<AnyElement> = Vec::new(); | 176 | let mut comp_rows: Vec<AnyElement> = Vec::new(); |
| 174 | let mut comp_measure: Vec<(String, String)> = Vec::new(); | 177 | let mut comp_measure: Vec<(String, String)> = Vec::new(); |
| 175 | let mut rows: Vec<AnyElement> = Vec::new(); | 178 | let mut rows: Vec<AnyElement> = Vec::new(); |
| @@ -299,63 +302,71 @@ impl Player { | |||
| 299 | let (comp_list, main_list): (Vec<ActionId>, Vec<ActionId>) = | 302 | let (comp_list, main_list): (Vec<ActionId>, Vec<ActionId>) = |
| 300 | rest.into_iter().partition(|a| fold && crate::menus::compound_item(*a)); | 303 | rest.into_iter().partition(|a| fold && crate::menus::compound_item(*a)); |
| 301 | let has_comp = !comp_list.is_empty(); | 304 | let has_comp = !comp_list.is_empty(); |
| 305 | + // Whether a row of the main list opens a choice submenu (Clip label, Fit to frame). | ||
| 306 | + let has_pick = fold | ||
| 307 | + && idx.is_some() | ||
| 308 | + && main_list.iter().any(|a| matches!(a, ActionId::ClipLabel | ActionId::Fit)); | ||
| 309 | + // A ▸ row that opens the submenu `which` beside itself. Hovering it opens that | ||
| 310 | + // submenu after ADJUST_HOVER, a click at once. Each row tracks its own hot state | ||
| 311 | + // (`sub_hot`), so resting on another ▸ row after the first has opened switches it. | ||
| 302 | let sub_row = |rows: &mut Vec<AnyElement>, | 312 | let sub_row = |rows: &mut Vec<AnyElement>, |
| 303 | measure: &mut Vec<(String, String)>, | 313 | measure: &mut Vec<(String, String)>, |
| 304 | - which: bool, | 314 | + which: Sub, |
| 315 | + (name, icon): (&'static str, Option<crate::ui::icons::Icon>), | ||
| 316 | + enabled: bool, | ||
| 305 | cx: &mut Context<Self>| { | 317 | cx: &mut Context<Self>| { |
| 306 | - let name = if which { "Compound" } else { "Adjust" }; | 318 | + let id: usize = match which { |
| 319 | + Sub::Compound => 901, | ||
| 320 | + Sub::Label => 902, | ||
| 321 | + Sub::Fit => 903, | ||
| 322 | + Sub::Adjust | Sub::Closed => 900, | ||
| 323 | + }; | ||
| 307 | measure.push((name.into(), "▸".into())); | 324 | measure.push((name.into(), "▸".into())); |
| 308 | rows.push( | 325 | rows.push( |
| 309 | - popup_row_icon( | 326 | + popup_row_icon(("menu", id), name, "▸", Some(false), icon, None) |
| 310 | - ("menu", 900usize + usize::from(which)), | 327 | + .when(enabled, |d| { |
| 311 | - name, | 328 | + d.on_hover(cx.listener(move |this, on: &bool, window, cx| { |
| 312 | - "▸", | 329 | + if !*on { |
| 313 | - Some(false), | 330 | + if this.sub_hot == which { |
| 314 | - Some(if which { | 331 | + this.sub_hot = Sub::Closed; |
| 315 | - crate::ui::icons::Icon::Layers | 332 | + } |
| 316 | - } else { | 333 | + return; |
| 317 | - crate::ui::icons::Icon::SlidersHorizontal | 334 | + } |
| 318 | - }), | 335 | + this.sub_hot = which; |
| 319 | - None, | 336 | + // Where the pointer came onto the row: the apex of |
| 320 | - ) | 337 | + // the safe triangle toward the submenu. |
| 321 | - .on_hover(cx.listener(move |this, on: &bool, window, cx| { | 338 | + this.adjust_aim = Some(window.mouse_position()); |
| 322 | - this.adjust_hot = *on; | 339 | + if this.context_menu.is_some_and(|m| m.sub != which) { |
| 323 | - if !*on { | 340 | + // Hover intent: opens once the pointer has |
| 324 | - return; | 341 | + // rested on the row for a moment, so a |
| 325 | - } | 342 | + // pointer crossing it does not flash the |
| 326 | - // Where the pointer came onto the row: the apex of | 343 | + // submenu. |
| 327 | - // the safe triangle toward the submenu. | 344 | + cx.spawn(async move |this, cx| { |
| 328 | - this.adjust_aim = Some(window.mouse_position()); | 345 | + cx.background_executor().timer(ADJUST_HOVER).await; |
| 329 | - if this.context_menu.is_some_and(|m| !m.adjust || m.compound != which) { | 346 | + let _ = this.update(cx, |this, cx| { |
| 330 | - // Hover intent: opens once the pointer has | 347 | + if this.sub_hot == which |
| 331 | - // rested on the row for a moment, so a | 348 | + && let Some(m) = &mut this.context_menu |
| 332 | - // pointer crossing it does not flash the | 349 | + && m.sub != which |
| 333 | - // submenu. | 350 | + { |
| 334 | - cx.spawn(async move |this, cx| { | 351 | + m.sub = which; |
| 335 | - cx.background_executor().timer(ADJUST_HOVER).await; | 352 | + cx.notify(); |
| 336 | - let _ = this.update(cx, |this, cx| { | 353 | + } |
| 337 | - if this.adjust_hot | 354 | + }); |
| 338 | - && let Some(m) = &mut this.context_menu | 355 | + }) |
| 339 | - && (!m.adjust || m.compound != which) | 356 | + .detach(); |
| 340 | - { | 357 | + } |
| 341 | - m.adjust = true; | 358 | + })) |
| 342 | - m.compound = which; | 359 | + }) |
| 343 | - cx.notify(); | ||
| 344 | - } | ||
| 345 | - }); | ||
| 346 | - }) | ||
| 347 | - .detach(); | ||
| 348 | - } | ||
| 349 | - })) | ||
| 350 | // A click opens it at once and never shuts it: the | 360 | // A click opens it at once and never shuts it: the |
| 351 | // hover may have opened it a moment before. | 361 | // hover may have opened it a moment before. |
| 352 | - .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | 362 | + .when(enabled, |d| { |
| 353 | - if let Some(m) = &mut this.context_menu { | 363 | + d.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 354 | - m.adjust = true; | 364 | + if let Some(m) = &mut this.context_menu { |
| 355 | - m.compound = which; | 365 | + m.sub = which; |
| 356 | - } | 366 | + } |
| 357 | - cx.notify(); | 367 | + cx.notify(); |
| 358 | - })) | 368 | + })) |
| 369 | + }) | ||
| 359 | .into_any_element(), | 370 | .into_any_element(), |
| 360 | ); | 371 | ); |
| 361 | }; | 372 | }; |
| @@ -366,9 +377,9 @@ impl Player { | |||
| 366 | adjust_at: &mut Option<usize>, | 377 | adjust_at: &mut Option<usize>, |
| 367 | cx: &mut Context<Self>| { | 378 | cx: &mut Context<Self>| { |
| 368 | *adjust_at = Some(rows.len()); | 379 | *adjust_at = Some(rows.len()); |
| 369 | - sub_row(rows, measure, false, cx); | 380 | + sub_row(rows, measure, Sub::Adjust, ("Adjust", Some(crate::ui::icons::Icon::SlidersHorizontal)), true, cx); |
| 370 | if has_comp { | 381 | if has_comp { |
| 371 | - sub_row(rows, measure, true, cx); | 382 | + sub_row(rows, measure, Sub::Compound, ("Compound", Some(crate::ui::icons::Icon::Layers)), true, cx); |
| 372 | } | 383 | } |
| 373 | }; | 384 | }; |
| 374 | // 0: the plate; 1: the Adjust submenu; 2: the Compound submenu. | 385 | // 0: the plate; 1: the Adjust submenu; 2: the Compound submenu. |
| @@ -404,6 +415,22 @@ impl Player { | |||
| 404 | // rather than printing a stroke that would do nothing. | 415 | // rather than printing a stroke that would do nothing. |
| 405 | let refusal = enable(action, ctx.clone()); | 416 | let refusal = enable(action, ctx.clone()); |
| 406 | let enabled = refusal.yes(); | 417 | let enabled = refusal.yes(); |
| 418 | + // Clip label and Fit to frame are ▸ rows like Adjust: the list they | ||
| 419 | + // offer hangs beside the row, and the row itself runs nothing. | ||
| 420 | + if let (true, Some(_), ActionId::ClipLabel | ActionId::Fit) = (fold, idx, action) { | ||
| 421 | + let (which, name) = match action { | ||
| 422 | + ActionId::Fit => { | ||
| 423 | + fit_at = Some(rows.len()); | ||
| 424 | + (Sub::Fit, "Fit to frame") | ||
| 425 | + } | ||
| 426 | + _ => { | ||
| 427 | + label_at = Some(rows.len()); | ||
| 428 | + (Sub::Label, "Clip label") | ||
| 429 | + } | ||
| 430 | + }; | ||
| 431 | + sub_row(rows, measure, which, (name, crate::menus::icon(action)), enabled, cx); | ||
| 432 | + continue; | ||
| 433 | + } | ||
| 407 | // The one item that is not about this clip says so, and says it | 434 | // The one item that is not about this clip says so, and says it |
| 408 | // here rather than in the registry: the stroke is global too, | 435 | // here rather than in the registry: the stroke is global too, |
| 409 | // but its row in the keys menu is not sitting on a clip. | 436 | // but its row in the keys menu is not sitting on a clip. |
| @@ -422,7 +449,8 @@ impl Player { | |||
| 422 | ActionId::ToggleSnap => { | 449 | ActionId::ToggleSnap => { |
| 423 | format!("Snap — {}", if self.snap { "on" } else { "off" }) | 450 | format!("Snap — {}", if self.snap { "on" } else { "off" }) |
| 424 | } | 451 | } |
| 425 | - ActionId::ClipLabel => "Label".to_string(), | 452 | + // A ▸ row in this menu, not a dialog: no ellipsis on its label. |
| 453 | + ActionId::Fit => "Fit to frame".to_string(), | ||
| 426 | // Plain words for the three that read as jargon; the action ids stay. | 454 | // Plain words for the three that read as jargon; the action ids stay. |
| 427 | ActionId::LoopTrim => "Loop while trimming".to_string(), | 455 | ActionId::LoopTrim => "Loop while trimming".to_string(), |
| 428 | ActionId::Dissolve => "Blend into next clip".to_string(), | 456 | ActionId::Dissolve => "Blend into next clip".to_string(), |
| @@ -447,10 +475,7 @@ impl Player { | |||
| 447 | | ActionId::NewTitle => format!("New {}", full.to_lowercase()), | 475 | | ActionId::NewTitle => format!("New {}", full.to_lowercase()), |
| 448 | _ => full.to_string(), | 476 | _ => full.to_string(), |
| 449 | }; | 477 | }; |
| 450 | - let hint = match action { | 478 | + let hint = shortcut(&self.keymap, action); |
| 451 | - ActionId::ClipLabel | ActionId::Fit => "▸".to_string(), | ||
| 452 | - _ => shortcut(&self.keymap, action), | ||
| 453 | - }; | ||
| 454 | // A switch wears the menu's ✓ when on, the bar's own style. | 479 | // A switch wears the menu's ✓ when on, the bar's own style. |
| 455 | let check = match (action, menu.on) { | 480 | let check = match (action, menu.on) { |
| 456 | (ActionId::ClipEnabled, _) => Some({ | 481 | (ActionId::ClipEnabled, _) => Some({ |
| @@ -472,7 +497,7 @@ impl Player { | |||
| 472 | crate::menus::icon(action), | 497 | crate::menus::icon(action), |
| 473 | refusal.why(), | 498 | refusal.why(), |
| 474 | ) | 499 | ) |
| 475 | - .when(!is_sub && has_sub, |d| { | 500 | + .when(!is_sub && (has_sub || has_pick), |d| { |
| 476 | d.on_hover(cx.listener(|this, on: &bool, window, cx| { | 501 | d.on_hover(cx.listener(|this, on: &bool, window, cx| { |
| 477 | // Another row under the pointer closes the | 502 | // Another row under the pointer closes the |
| 478 | // submenu -- unless the pointer is crossing | 503 | // submenu -- unless the pointer is crossing |
| @@ -488,10 +513,10 @@ impl Player { | |||
| 488 | }; | 513 | }; |
| 489 | if let Some(m) = &mut this.context_menu | 514 | if let Some(m) = &mut this.context_menu |
| 490 | && *on | 515 | && *on |
| 491 | - && m.adjust | 516 | + && m.sub != Sub::Closed |
| 492 | && !toward | 517 | && !toward |
| 493 | { | 518 | { |
| 494 | - m.adjust = false; | 519 | + m.sub = Sub::Closed; |
| 495 | cx.notify(); | 520 | cx.notify(); |
| 496 | } | 521 | } |
| 497 | })) | 522 | })) |
| @@ -505,28 +530,11 @@ impl Player { | |||
| 505 | d.cursor_pointer() | 530 | d.cursor_pointer() |
| 506 | .hover(|s| s.bg(rgba(crate::ui::theme::WASH_HOVER))) | 531 | .hover(|s| s.bg(rgba(crate::ui::theme::WASH_HOVER))) |
| 507 | .on_click(cx.listener( | 532 | .on_click(cx.listener( |
| 508 | - move |this, event: &ClickEvent, window, cx| { | 533 | + move |this, _: &ClickEvent, window, cx| { |
| 509 | // Closed first: the action moves the very | 534 | // Closed first: the action moves the very |
| 510 | // indices this menu is holding. | 535 | // indices this menu is holding. |
| 511 | this.context_menu = None; | 536 | this.context_menu = None; |
| 512 | - // The one item that is a *choice* and not a | 537 | + if let (MenuOn::Head, Some(size)) = |
| 513 | - // doing: four policies, so the pointer gets | ||
| 514 | - // the list of them on this clip rather than | ||
| 515 | - // the next one stepped to behind the click. | ||
| 516 | - // The stroke still steps -- same door. | ||
| 517 | - if let (ActionId::ClipLabel, Some(idx)) = (action, idx) { | ||
| 518 | - this.open_picker( | ||
| 519 | - Pick::Label(menu.lane, idx), | ||
| 520 | - event.position(), | ||
| 521 | - cx, | ||
| 522 | - ); | ||
| 523 | - } else if let (ActionId::Fit, Some(idx)) = (action, idx) { | ||
| 524 | - this.open_picker( | ||
| 525 | - Pick::Fit(menu.lane, idx), | ||
| 526 | - event.position(), | ||
| 527 | - cx, | ||
| 528 | - ); | ||
| 529 | - } else if let (MenuOn::Head, Some(size)) = | ||
| 530 | (menu.on, crate::ui::bench_stance::TrackSize::of_action(action)) | 538 | (menu.on, crate::ui::bench_stance::TrackSize::of_action(action)) |
| 531 | { | 539 | { |
| 532 | // A header's own height: this track only, not every track. | 540 | // A header's own height: this track only, not every track. |
| @@ -610,10 +618,20 @@ impl Player { | |||
| 610 | let h = MENU_PAD * 2. + list_h; | 618 | let h = MENU_PAD * 2. + list_h; |
| 611 | let pw = popup_w(measure.iter().map(|(l, h)| (l.as_str(), h.as_str())), true); | 619 | let pw = popup_w(measure.iter().map(|(l, h)| (l.as_str(), h.as_str())), true); |
| 612 | let (x, y) = menu_at_w(menu_above(at, viewport, floor, h), viewport, pw, h); | 620 | let (x, y) = menu_at_w(menu_above(at, viewport, floor, h), viewport, pw, h); |
| 613 | - // The submenu that is out: Adjust's, or Compound's. | 621 | + // The submenu that is out, and the row it hangs from: Adjust's, Compound's, or a |
| 614 | - let (sub_rows, sub_measure, sub_at) = match menu.compound { | 622 | + // choice list (Clip label, Fit to frame) built from the picker's own rows. |
| 615 | - true => (comp_rows, comp_measure, adjust_at.map(|a| a + 1)), | 623 | + let (sub_rows, sub_measure, sub_at) = match (menu.sub, idx) { |
| 616 | - false => (sub_rows, sub_measure, adjust_at), | 624 | + (Sub::Adjust, _) => (sub_rows, sub_measure, adjust_at), |
| 625 | + (Sub::Compound, _) => (comp_rows, comp_measure, adjust_at.map(|a| a + 1)), | ||
| 626 | + (Sub::Label, Some(idx)) => { | ||
| 627 | + let (rows, measure) = self.choice_sub_rows(Pick::Label(menu.lane, idx), cx); | ||
| 628 | + (rows, measure, label_at) | ||
| 629 | + } | ||
| 630 | + (Sub::Fit, Some(idx)) => { | ||
| 631 | + let (rows, measure) = self.choice_sub_rows(Pick::Fit(menu.lane, idx), cx); | ||
| 632 | + (rows, measure, fit_at) | ||
| 633 | + } | ||
| 634 | + _ => (Vec::new(), Vec::new(), None), | ||
| 617 | }; | 635 | }; |
| 618 | // The submenu's near edge, for the safe triangle (see `adjust_sub`). | 636 | // The submenu's near edge, for the safe triangle (see `adjust_sub`). |
| 619 | self.adjust_sub.set(match sub_rows.is_empty() { | 637 | self.adjust_sub.set(match sub_rows.is_empty() { |
| @@ -689,9 +707,9 @@ impl Player { | |||
| 689 | .children(rows), | 707 | .children(rows), |
| 690 | ), | 708 | ), |
| 691 | ) | 709 | ) |
| 692 | - // The Adjust submenu, beside the plate at its row; on the left | 710 | + // The open submenu, beside the plate at its row; on the left |
| 693 | // of it where the right edge has no room. | 711 | // of it where the right edge has no room. |
| 694 | - .children((menu.adjust && !sub_rows.is_empty()).then(|| { | 712 | + .children((!sub_rows.is_empty()).then(|| { |
| 695 | let sw = popup_w( | 713 | let sw = popup_w( |
| 696 | sub_measure.iter().map(|(l, h)| (l.as_str(), h.as_str())), | 714 | sub_measure.iter().map(|(l, h)| (l.as_str(), h.as_str())), |
| 697 | true, | 715 | true, |
| @@ -715,6 +733,27 @@ impl Player { | |||
| 715 | ) | 733 | ) |
| 716 | } | 734 | } |
| 717 | 735 | ||
| 736 | + /// The rows of a clip menu's choice submenu: the list the picker shows for `of` | ||
| 737 | + /// ([`Player::choices`]), each row picking through [`Player::choose`] and closing the menu. | ||
| 738 | + fn choice_sub_rows(&self, of: Pick, cx: &mut Context<Self>) -> (Vec<AnyElement>, Vec<(String, String)>) { | ||
| 739 | + let mut rows: Vec<AnyElement> = Vec::new(); | ||
| 740 | + let mut measure: Vec<(String, String)> = Vec::new(); | ||
| 741 | + for (n, (choice, label, detail, picked)) in self.choices(of).into_iter().enumerate() { | ||
| 742 | + measure.push((label.to_string(), detail.to_string())); | ||
| 743 | + rows.push( | ||
| 744 | + popup_row(("menu-choice", n), label, detail, Some(picked), None) | ||
| 745 | + .cursor_pointer() | ||
| 746 | + .hover(|s| s.bg(rgba(crate::ui::theme::WASH_HOVER))) | ||
| 747 | + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { | ||
| 748 | + this.context_menu = None; | ||
| 749 | + this.choose(choice, cx); | ||
| 750 | + })) | ||
| 751 | + .into_any_element(), | ||
| 752 | + ); | ||
| 753 | + } | ||
| 754 | + (rows, measure) | ||
| 755 | + } | ||
| 756 | + | ||
| 718 | /// The open choice list: every value of one enumerated setting at once, the | 757 | /// The open choice list: every value of one enumerated setting at once, the |
| 719 | /// one in force marked, and a click on any of them picks *that* one -- what | 758 | /// one in force marked, and a click on any of them picks *that* one -- what |
| 720 | /// a button stepping one value on per click could never say. Built on the | 759 | /// a button stepping one value on per click could never say. Built on the |
crates/app/src/ui/popup.rsmodified+1 -1
| @@ -475,7 +475,7 @@ mod tests { | |||
| 475 | .filter(|a| !crate::menus::adjust_item(**a) && !crate::menus::compound_item(**a)) | 475 | .filter(|a| !crate::menus::adjust_item(**a) && !crate::menus::compound_item(**a)) |
| 476 | .count() | 476 | .count() |
| 477 | + 3; // Adjust, Compound and Properties | 477 | + 3; // Adjust, Compound and Properties |
| 478 | - assert!(top <= 19, "{top} rows"); | 478 | + assert!(top <= 20, "{top} rows"); |
| 479 | let view = size(px(1280.), px(720.)); | 479 | let view = size(px(1280.), px(720.)); |
| 480 | let list_h = crate::oracle::menu_rows_h(top + 1, view); | 480 | let list_h = crate::oracle::menu_rows_h(top + 1, view); |
| 481 | let h = MENU_PAD * 2. + list_h; | 481 | let h = MENU_PAD * 2. + list_h; |
crates/app/src/ui/settings_stance.rsmodified+4 -4
| @@ -642,7 +642,7 @@ fn project_section(player: &Player, cx: &mut Context<Player>) -> impl IntoElemen | |||
| 642 | // ([`Player::proxy_tail`], its own separator dropped). | 642 | // ([`Player::proxy_tail`], its own separator dropped). |
| 643 | .child(choice_row( | 643 | .child(choice_row( |
| 644 | "settings-proxies", | 644 | "settings-proxies", |
| 645 | - "Editing copies", | 645 | + "Editing copies (proxies)", |
| 646 | "Lighter copies for smooth playback; export always uses the originals", | 646 | "Lighter copies for smooth playback; export always uses the originals", |
| 647 | chord_of(player, ActionId::ToggleProxies), | 647 | chord_of(player, ActionId::ToggleProxies), |
| 648 | { | 648 | { |
| @@ -694,7 +694,7 @@ fn still_row(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 694 | .tooltip(crate::ui::widgets::tip_hover( | 694 | .tooltip(crate::ui::widgets::tip_hover( |
| 695 | "Still image length", | 695 | "Still image length", |
| 696 | "", | 696 | "", |
| 697 | - Some("how long a picture or title card is placed for when it is dropped on the timeline; clips already placed keep theirs"), | 697 | + Some("How long a picture or title card lasts when it is dropped on the timeline; clips already placed keep theirs"), |
| 698 | )) | 698 | )) |
| 699 | .child( | 699 | .child( |
| 700 | div() | 700 | div() |
| @@ -924,7 +924,7 @@ fn vivid_row(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 924 | .tooltip(crate::ui::widgets::overlay_tip_hover( | 924 | .tooltip(crate::ui::widgets::overlay_tip_hover( |
| 925 | "Vivid", | 925 | "Vivid", |
| 926 | "", | 926 | "", |
| 927 | - Some("How strong the accent colour is: 0 is a faint tint, 50 the colours as designed, 100 bold."), | 927 | + Some("How strong the accent colour is: 0 is a faint tint, 50 keeps the colours as designed, 100 bold."), |
| 928 | )) | 928 | )) |
| 929 | .child(slider_row_inline( | 929 | .child(slider_row_inline( |
| 930 | SliderRow { | 930 | SliderRow { |
| @@ -2046,7 +2046,7 @@ mod tests { | |||
| 2046 | // (label, tail, row); the key lives in the tooltip, the column is empty. | 2046 | // (label, tail, row); the key lives in the tooltip, the column is empty. |
| 2047 | let rows: [(&str, &str, ChoiceRow); 3] = [ | 2047 | let rows: [(&str, &str, ChoiceRow); 3] = [ |
| 2048 | ("When HDR plays on a normal screen", "", ChoiceRow::Tone), | 2048 | ("When HDR plays on a normal screen", "", ChoiceRow::Tone), |
| 2049 | - ("Editing copies", "100%", ChoiceRow::Proxies), | 2049 | + ("Editing copies (proxies)", "100%", ChoiceRow::Proxies), |
| 2050 | (" Make them on import", "", ChoiceRow::AutoProxies), | 2050 | (" Make them on import", "", ChoiceRow::AutoProxies), |
| 2051 | ]; | 2051 | ]; |
| 2052 | for (label, tail, row) in rows { | 2052 | for (label, tail, row) in rows { |
crates/app/src/ui/stance.rsmodified+32 -20
| @@ -1412,6 +1412,9 @@ pub(crate) fn render( | |||
| 1412 | // disagree here either. | 1412 | // disagree here either. |
| 1413 | let dock_w = player.split_px(Split::Dock, window_size); | 1413 | let dock_w = player.split_px(Split::Dock, window_size); |
| 1414 | let bench_h = player.split_px(Split::Bench, window_size); | 1414 | let bench_h = player.split_px(Split::Bench, window_size); |
| 1415 | + // Player fullscreen (F11, `ActionId::Fullscreen`): the picture and the transport band only. | ||
| 1416 | + // Only the children below change; the root keeps its handlers and focus. | ||
| 1417 | + let fullscreen = player.player_fullscreen; | ||
| 1415 | div() | 1418 | div() |
| 1416 | .id("stance-room") | 1419 | .id("stance-room") |
| 1417 | // Inter is the default face for any text that sets no role of its own. | 1420 | // Inter is the default face for any text that sets no role of its own. |
| @@ -1451,7 +1454,7 @@ pub(crate) fn render( | |||
| 1451 | if let (Some(m), "left" | "right") = (this.context_menu.as_mut(), key) | 1454 | if let (Some(m), "left" | "right") = (this.context_menu.as_mut(), key) |
| 1452 | && matches!(m.on, MenuOn::Clip(_)) | 1455 | && matches!(m.on, MenuOn::Clip(_)) |
| 1453 | { | 1456 | { |
| 1454 | - m.adjust = key == "right"; | 1457 | + m.sub = if key == "right" { Sub::Adjust } else { Sub::Closed }; |
| 1455 | cx.notify(); | 1458 | cx.notify(); |
| 1456 | return; | 1459 | return; |
| 1457 | } | 1460 | } |
| @@ -1937,9 +1940,9 @@ pub(crate) fn render( | |||
| 1937 | .size_full() | 1940 | .size_full() |
| 1938 | // The menu bar is laid over the top rows (`menubar::bar`, absolute), so | 1941 | // The menu bar is laid over the top rows (`menubar::bar`, absolute), so |
| 1939 | // the room starts below it. | 1942 | // the room starts below it. |
| 1940 | - .pt(px(MENU_BAR_H)) | 1943 | + .pt(px(if fullscreen { 0. } else { MENU_BAR_H })) |
| 1941 | .flex() | 1944 | .flex() |
| 1942 | - .bg(rgb(DARK_CANVAS())) | 1945 | + .bg(rgb(if fullscreen { 0x000000 } else { DARK_CANVAS() })) |
| 1943 | .children(hitmap::frame()) | 1946 | .children(hitmap::frame()) |
| 1944 | .child(mouse_exit_listener(cx)) | 1947 | .child(mouse_exit_listener(cx)) |
| 1945 | .child( | 1948 | .child( |
| @@ -1954,15 +1957,20 @@ pub(crate) fn render( | |||
| 1954 | .min_w(px(0.)) | 1957 | .min_w(px(0.)) |
| 1955 | .flex() | 1958 | .flex() |
| 1956 | .flex_col() | 1959 | .flex_col() |
| 1957 | - .child(screen(player, position, window, cx)) | 1960 | + // Fullscreen stands the picture up alone (the same builder the |
| 1961 | + // darkroom's screen uses), with the time band under it. | ||
| 1962 | + .when(fullscreen, |el| el.child(player.picture_area(position, window, cx))) | ||
| 1963 | + .when(!fullscreen, |el| el.child(screen(player, position, window, cx))) | ||
| 1958 | .child(time_band(player, position, cx)) | 1964 | .child(time_band(player, position, cx)) |
| 1959 | - .child(divider( | 1965 | + .when(!fullscreen, |el| { |
| 1960 | - Split::Bench, | 1966 | + el.child(divider( |
| 1961 | - player.split_drag == Some(Split::Bench), | 1967 | + Split::Bench, |
| 1962 | - cx, | 1968 | + player.split_drag == Some(Split::Bench), |
| 1963 | - )) | 1969 | + cx, |
| 1964 | - .child(bench(player, bench_h, window, cx)) | 1970 | + )) |
| 1965 | - .child(ledger(player, cx)) | 1971 | + .child(bench(player, bench_h, window, cx)) |
| 1972 | + .child(ledger(player, cx)) | ||
| 1973 | + }) | ||
| 1966 | // A maximized clip param card (EQ/Colour/Transform/Speed/ | 1974 | // A maximized clip param card (EQ/Colour/Transform/Speed/ |
| 1967 | // Silence/Mix/Subtitle style) escapes the dock to mount here | 1975 | // Silence/Mix/Subtitle style) escapes the dock to mount here |
| 1968 | // instead, the same window-space `stance-centre` context | 1976 | // instead, the same window-space `stance-centre` context |
| @@ -1975,7 +1983,7 @@ pub(crate) fn render( | |||
| 1975 | // same seven functions stay mounted in the dock | 1983 | // same seven functions stay mounted in the dock |
| 1976 | // (`dock_stance::clip_tab`'s own `.when(!card_maximized, ...)` | 1984 | // (`dock_stance::clip_tab`'s own `.when(!card_maximized, ...)` |
| 1977 | // guard keeps this from ever double-mounting one). | 1985 | // guard keeps this from ever double-mounting one). |
| 1978 | - .when(player.card_maximized, |el| { | 1986 | + .when(player.card_maximized && !fullscreen, |el| { |
| 1979 | el.children(player.eq_card(window_size, cx)) | 1987 | el.children(player.eq_card(window_size, cx)) |
| 1980 | .children(player.color_card(window_size, cx)) | 1988 | .children(player.color_card(window_size, cx)) |
| 1981 | .children(player.transform_card(window_size, cx)) | 1989 | .children(player.transform_card(window_size, cx)) |
| @@ -1990,12 +1998,14 @@ pub(crate) fn render( | |||
| 1990 | .children(player.subtitle_style_card(window_size, cx)) | 1998 | .children(player.subtitle_style_card(window_size, cx)) |
| 1991 | }), | 1999 | }), |
| 1992 | ) | 2000 | ) |
| 1993 | - .child(divider( | 2001 | + .when(!fullscreen, |el| { |
| 1994 | - Split::Dock, | 2002 | + el.child(divider( |
| 1995 | - player.split_drag == Some(Split::Dock), | 2003 | + Split::Dock, |
| 1996 | - cx, | 2004 | + player.split_drag == Some(Split::Dock), |
| 1997 | - )) | 2005 | + cx, |
| 1998 | - .child(dock(player, dock_w, window_size, window, cx)) | 2006 | + )) |
| 2007 | + .child(dock(player, dock_w, window_size, window, cx)) | ||
| 2008 | + }) | ||
| 1999 | // All three hanging menus (DESIGN §9: "verbs of the thing under the | 2009 | // All three hanging menus (DESIGN §9: "verbs of the thing under the |
| 2000 | // cursor") mount on the ROOT, and none of them inside | 2010 | // cursor") mount on the ROOT, and none of them inside |
| 2001 | // `stance-centre`. Their anchors are *window* coordinates -- a | 2011 | // `stance-centre`. Their anchors are *window* coordinates -- a |
| @@ -2013,8 +2023,10 @@ pub(crate) fn render( | |||
| 2013 | // menu, then the open list last so it floats over whichever row set it. | 2023 | // menu, then the open list last so it floats over whichever row set it. |
| 2014 | // The menu bar sits over the room's top edge and its click-away under | 2024 | // The menu bar sits over the room's top edge and its click-away under |
| 2015 | // the root's own menus; its dropdown is deferred, so it paints over both. | 2025 | // the root's own menus; its dropdown is deferred, so it paints over both. |
| 2016 | - .child(menubar::bar(player, f32::from(viewport.width), f32::from(viewport.height), cx)) | 2026 | + .when(!fullscreen, |el| { |
| 2017 | - .children(menubar::backdrop(player, cx)) | 2027 | + el.child(menubar::bar(player, f32::from(viewport.width), f32::from(viewport.height), cx)) |
| 2028 | + .children(menubar::backdrop(player, cx)) | ||
| 2029 | + }) | ||
| 2018 | .children(player.context_card(viewport, cx)) | 2030 | .children(player.context_card(viewport, cx)) |
| 2019 | .children(player.library_card(viewport, cx)) | 2031 | .children(player.library_card(viewport, cx)) |
| 2020 | .children(player.picker_card(viewport, cx)) | 2032 | .children(player.picker_card(viewport, cx)) |
crates/app/src/ui/timeband_stance.rsmodified+46 -70
| @@ -1,7 +1,7 @@ | |||
| 1 | //! The transport band's own content (REDESIGN §3.3, DESIGN.md §6.3): the | 1 | //! The transport band's own content (REDESIGN §3.3, DESIGN.md §6.3): the |
| 2 | //! timecode on the left, icon-only transport controls centred (go to start, | 2 | //! timecode on the left, icon-only transport controls centred (go to start, |
| 3 | //! frame back, play, frame forward, go to end, loop), then mute, the volume | 3 | //! frame back, play, frame forward, go to end, loop), then mute, the volume |
| 4 | -//! slider and the level meter on the right. Words and keys live in the | 4 | +//! slider, the level meter and fullscreen on the right. Words and keys live in the |
| 5 | //! tooltips only. The trim deltas show only while a loop-trim roll is armed. | 5 | //! tooltips only. The trim deltas show only while a loop-trim roll is armed. |
| 6 | //! The band is 44px tall. The overview strip sits above the ruler | 6 | //! The band is 44px tall. The overview strip sits above the ruler |
| 7 | //! (`ui/bench_stance/overview.rs`); Export lives on the menu bar | 7 | //! (`ui/bench_stance/overview.rs`); Export lives on the menu bar |
| @@ -137,6 +137,7 @@ fn volume_slider(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | |||
| 137 | let t = crate::ui::theme::tokens(); | 137 | let t = crate::ui::theme::tokens(); |
| 138 | let fill = if player.volume.muted { t.ink3 } else { t.accent }; | 138 | let fill = if player.volume.muted { t.ink3 } else { t.accent }; |
| 139 | let half = VOLUME_THUMB / 2.; | 139 | let half = VOLUME_THUMB / 2.; |
| 140 | + let level = master_level(player); | ||
| 140 | div() | 141 | div() |
| 141 | .id("stance-volume") | 142 | .id("stance-volume") |
| 142 | .flex_none() | 143 | .flex_none() |
| @@ -147,7 +148,7 @@ fn volume_slider(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | |||
| 147 | .tooltip(crate::ui::widgets::tip_hover( | 148 | .tooltip(crate::ui::widgets::tip_hover( |
| 148 | "Volume", | 149 | "Volume", |
| 149 | "", | 150 | "", |
| 150 | - Some(&format!("{}%", player.volume.percent())), | 151 | + Some(&format!("{}% \u{b7} the bright part is the sound playing now", player.volume.percent())), |
| 151 | )) | 152 | )) |
| 152 | .on_mouse_down( | 153 | .on_mouse_down( |
| 153 | MouseButton::Left, | 154 | MouseButton::Left, |
| @@ -174,10 +175,26 @@ fn volume_slider(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | |||
| 174 | .bg(rgb(t.e3)) | 175 | .bg(rgb(t.e3)) |
| 175 | .child( | 176 | .child( |
| 176 | div() | 177 | div() |
| 178 | + .relative() | ||
| 177 | .h_full() | 179 | .h_full() |
| 178 | .w(relative(player.volume.along())) | 180 | .w(relative(player.volume.along())) |
| 179 | .rounded(px(2.)) | 181 | .rounded(px(2.)) |
| 180 | - .bg(rgb(fill)), | 182 | + // Playing, the set level dims to a bed and the live level |
| 183 | + // rides inside it; at rest it is the plain fill. | ||
| 184 | + .map(|d| match level { | ||
| 185 | + Some(_) => d.bg(rgba((fill << 8) | 0x55)), | ||
| 186 | + None => d.bg(rgb(fill)), | ||
| 187 | + }) | ||
| 188 | + .children(level.map(|(frac, hot, clipped)| { | ||
| 189 | + let ink = if clipped { | ||
| 190 | + crate::ui::theme::STATUS_ERROR() | ||
| 191 | + } else if hot { | ||
| 192 | + crate::ui::theme::STATUS_WARNING() | ||
| 193 | + } else { | ||
| 194 | + fill | ||
| 195 | + }; | ||
| 196 | + div().absolute().left_0().top_0().h_full().w(relative(frac)).rounded(px(2.)).bg(rgb(ink)) | ||
| 197 | + })), | ||
| 181 | ), | 198 | ), |
| 182 | ) | 199 | ) |
| 183 | .child( | 200 | .child( |
| @@ -223,70 +240,21 @@ fn icon_tip(player: &Player, action: ActionId) -> TipFn { | |||
| 223 | } | 240 | } |
| 224 | } | 241 | } |
| 225 | 242 | ||
| 226 | -/// The master level meter's length on the band, in px. | 243 | +/// The live output level for the volume slider's track, while sound is moving: how far along the |
| 227 | -const METER_W: f32 = 32.; | 244 | +/// set level the louder side reaches (0..1 of the fill), and whether it is within 1 dB of full |
| 228 | - | 245 | +/// scale or clipped. Read through [`Player::master_reading`] (at most 30 times a second, from the |
| 229 | -/// The stereo master level meter before the volume: two 4px bars (left over right), each to its | 246 | +/// engine's own stereo peaks, so the mix card's meters do not compete with it). The level lives |
| 230 | -/// level with a 1px marker at its held peak, warning-coloured within 1 dB of full scale, and a | 247 | +/// inside the slider rather than as bars beside it: a second little control next to the volume |
| 231 | -/// clip lamp at the right end that stays lit for a few seconds after a peak reached 0 dBFS. The | 248 | +/// read as noise, and inside the fill it says what the meter is for at a glance. |
| 232 | -/// lamp's slot is always there, so a clip moves nothing. Read through [`Player::master_reading`] | 249 | +fn master_level(player: &Player) -> Option<(f32, bool, bool)> { |
| 233 | -/// (at most 30 times a second, from the engine's own stereo peaks, so the mix card's meters do not | ||
| 234 | -/// compete with it). | ||
| 235 | -fn level_meter(player: &Player) -> impl IntoElement { | ||
| 236 | use crate::player::cards::METER_FLOOR_DB; | 250 | use crate::player::cards::METER_FLOOR_DB; |
| 237 | - let now = std::time::Instant::now(); | 251 | + if !player.session.as_ref().is_some_and(|s| s.is_playing()) || player.volume.muted { |
| 238 | - let (meters, clipped) = player.master_reading(now); | 252 | + return None; |
| 239 | - let frac = |db: f32| ((db - METER_FLOOR_DB) / -METER_FLOOR_DB).clamp(0., 1.); | 253 | + } |
| 240 | - let bar = |side: usize| { | 254 | + let (meters, clipped) = player.master_reading(std::time::Instant::now()); |
| 241 | - let meter = Some(meters[side]); | 255 | + let db = meters[0].level_db.max(meters[1].level_db); |
| 242 | - let level = meter.map_or(0., |m| frac(m.level_db)); | 256 | + let frac = ((db - METER_FLOOR_DB) / -METER_FLOOR_DB).clamp(0., 1.); |
| 243 | - let hold = meter.map_or(0., |m| frac(m.hold_db)); | 257 | + Some((frac, db >= -1., clipped)) |
| 244 | - let hot = meter.is_some_and(|m| m.level_db >= -1.); | ||
| 245 | - div() | ||
| 246 | - .flex_none() | ||
| 247 | - .relative() | ||
| 248 | - .w_full() | ||
| 249 | - .h(px(4.)) | ||
| 250 | - .rounded(px(2.)) | ||
| 251 | - // The raised plate, not the panel: the band is panel-coloured, and a | ||
| 252 | - // bed the band's own colour would vanish at rest. | ||
| 253 | - .bg(rgb(DARK_RAISED())) | ||
| 254 | - .child(div().h_full().w(relative(level)).rounded(px(2.)).bg(rgb( | ||
| 255 | - if hot { STATUS_WARNING() } else { ACCENT_PRIMARY() }, | ||
| 256 | - ))) | ||
| 257 | - .when(hold > 0., |d| { | ||
| 258 | - d.child( | ||
| 259 | - div() | ||
| 260 | - .absolute() | ||
| 261 | - .top_0() | ||
| 262 | - .h_full() | ||
| 263 | - .w(px(1.)) | ||
| 264 | - .left(relative(hold)) | ||
| 265 | - .bg(rgb(INK1())), | ||
| 266 | - ) | ||
| 267 | - }) | ||
| 268 | - }; | ||
| 269 | - div() | ||
| 270 | - .id("stance-tb-meter") | ||
| 271 | - .flex_none() | ||
| 272 | - .flex() | ||
| 273 | - .items_center() | ||
| 274 | - .gap(px(3.)) | ||
| 275 | - .w(px(METER_W)) | ||
| 276 | - .tooltip(crate::ui::widgets::tip_hover( | ||
| 277 | - "Master level, left over right. The lamp lights on a clipped peak.", | ||
| 278 | - "", | ||
| 279 | - None, | ||
| 280 | - )) | ||
| 281 | - .child(div().flex_1().flex().flex_col().gap(px(1.)).child(bar(0)).child(bar(1))) | ||
| 282 | - .child( | ||
| 283 | - div() | ||
| 284 | - .flex_none() | ||
| 285 | - .w(px(3.)) | ||
| 286 | - .h(px(9.)) | ||
| 287 | - .rounded(px(1.5)) | ||
| 288 | - .bg(rgb(if clipped { STATUS_ERROR() } else { DARK_RAISED() })), | ||
| 289 | - ) | ||
| 290 | } | 258 | } |
| 291 | 259 | ||
| 292 | /// The timecode on the transport (REDESIGN §3.3): the `timecode` role, digits in | 260 | /// The timecode on the transport (REDESIGN §3.3): the `timecode` role, digits in |
| @@ -383,7 +351,8 @@ fn play_button(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 383 | } | 351 | } |
| 384 | 352 | ||
| 385 | /// The width of the timecode cluster and of the volume cluster: equal, so the | 353 | /// The width of the timecode cluster and of the volume cluster: equal, so the |
| 386 | -/// transport between them sits on the column's centre. | 354 | +/// transport between them sits on the column's centre. The tail (Mute, volume, |
| 355 | +/// Fullscreen, with 4px gaps) is 168px, inside it. | ||
| 387 | const SIDE_W: f32 = 184.; | 356 | const SIDE_W: f32 = 184.; |
| 388 | 357 | ||
| 389 | /// The whole band, left to right: the timecode, the transport centred in the | 358 | /// The whole band, left to right: the timecode, the transport centred in the |
| @@ -397,7 +366,6 @@ pub(crate) fn render( | |||
| 397 | use crate::ui::icons::Icon; | 366 | use crate::ui::icons::Icon; |
| 398 | let tc = timecode(player.hero_position(position), player.active_fps()); | 367 | let tc = timecode(player.hero_position(position), player.active_fps()); |
| 399 | let band_w = BAND_W.with(Rc::clone); | 368 | let band_w = BAND_W.with(Rc::clone); |
| 400 | - let wide = column_w() >= 900.; | ||
| 401 | // Go to time retypes the timecode in place; a click on it opens that. | 369 | // Go to time retypes the timecode in place; a click on it opens that. |
| 402 | let timecode_cell = match player.time_edit.clone() { | 370 | let timecode_cell = match player.time_edit.clone() { |
| 403 | Some(field) => timecode_field(&field).into_any_element(), | 371 | Some(field) => timecode_field(&field).into_any_element(), |
| @@ -465,8 +433,16 @@ pub(crate) fn render( | |||
| 465 | cx, | 433 | cx, |
| 466 | )) | 434 | )) |
| 467 | .child(volume_slider(player, cx)) | 435 | .child(volume_slider(player, cx)) |
| 468 | - // The meter is the first thing to go when the column narrows. | 436 | + // Fullscreen closes the row at its right end, as video players do: the same |
| 469 | - .when(wide, |d| d.child(level_meter(player))), | 437 | + // icon button as the transport's, dispatching `ActionId::Fullscreen` through `act`. |
| 438 | + .child(icon_button( | ||
| 439 | + "stance-tb-fullscreen", | ||
| 440 | + player, | ||
| 441 | + Icon::Scan, | ||
| 442 | + ActionId::Fullscreen, | ||
| 443 | + player.player_fullscreen, | ||
| 444 | + cx, | ||
| 445 | + )), | ||
| 470 | ) | 446 | ) |
| 471 | } | 447 | } |
| 472 | 448 | ||
crates/app/src/ui/widgets.rsmodified+17 -5
| @@ -534,17 +534,20 @@ fn tip_boxed(plate: Div, w: f32, window: Option<&Window>) -> Div { | |||
| 534 | } | 534 | } |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | +/// One line of a hover plate: the keycap's height, so a label and its chips share a line box | ||
| 538 | +/// and the text centres on the chips. | ||
| 539 | +const TIP_LINE_PX: f32 = 18.; | ||
| 540 | + | ||
| 537 | /// DESIGN §2.5 and §4.5: a tooltip is a floating plate, so it is a panel with a | 541 | /// DESIGN §2.5 and §4.5: a tooltip is a floating plate, so it is a panel with a |
| 538 | /// hairline, a 6px radius and the one shadow the room uses for floating plates | 542 | /// hairline, a 6px radius and the one shadow the room uses for floating plates |
| 539 | -/// (menus, the palette, sheets, toasts). Padded 8px down and 10px across. | 543 | +/// (menus, the palette, sheets, toasts). Padded 10px on every side. |
| 540 | fn tip_plate() -> Div { | 544 | fn tip_plate() -> Div { |
| 541 | crate::ui::kit::plate(6.) | 545 | crate::ui::kit::plate(6.) |
| 542 | .flex() | 546 | .flex() |
| 543 | .flex_none() | 547 | .flex_none() |
| 544 | .flex_col() | 548 | .flex_col() |
| 545 | .gap(px(4.)) | 549 | .gap(px(4.)) |
| 546 | - .px(px(10.)) | 550 | + .p(px(10.)) |
| 547 | - .py(px(8.)) | ||
| 548 | } | 551 | } |
| 549 | 552 | ||
| 550 | /// A plain prose tooltip ([`Tip`], [`OverlayTip`]): one line in ink1 on the | 553 | /// A plain prose tooltip ([`Tip`], [`OverlayTip`]): one line in ink1 on the |
| @@ -560,7 +563,7 @@ fn tip_text(text: &SharedString, window: Option<&Window>) -> Div { | |||
| 560 | .font(name.font) | 563 | .font(name.font) |
| 561 | .text_size(name.size) | 564 | .text_size(name.size) |
| 562 | .text_color(rgb(INK1())) | 565 | .text_color(rgb(INK1())) |
| 563 | - .children(lines.into_iter().map(|l| div().whitespace_nowrap().child(l))), | 566 | + .children(lines.into_iter().map(|l| div().h(px(TIP_LINE_PX)).line_height(px(TIP_LINE_PX)).whitespace_nowrap().child(l))), |
| 564 | w, | 567 | w, |
| 565 | window, | 568 | window, |
| 566 | ) | 569 | ) |
| @@ -576,6 +579,10 @@ fn tip_card(parts: &TipParts, window: Option<&Window>) -> Div { | |||
| 576 | let last = name_lines.pop().unwrap_or_default(); | 579 | let last = name_lines.pop().unwrap_or_default(); |
| 577 | let ink = |l: String, c: u32| { | 580 | let ink = |l: String, c: u32| { |
| 578 | div() | 581 | div() |
| 582 | + .h(px(TIP_LINE_PX)) | ||
| 583 | + .line_height(px(TIP_LINE_PX)) | ||
| 584 | + .flex() | ||
| 585 | + .items_center() | ||
| 579 | .whitespace_nowrap() | 586 | .whitespace_nowrap() |
| 580 | .font(name.font.clone()) | 587 | .font(name.font.clone()) |
| 581 | .text_size(name.size) | 588 | .text_size(name.size) |
| @@ -588,9 +595,10 @@ fn tip_card(parts: &TipParts, window: Option<&Window>) -> Div { | |||
| 588 | .children(name_lines.iter().cloned().map(|l| ink(l, INK1()))) | 595 | .children(name_lines.iter().cloned().map(|l| ink(l, INK1()))) |
| 589 | .child( | 596 | .child( |
| 590 | div() | 597 | div() |
| 598 | + .h(px(TIP_LINE_PX)) | ||
| 591 | .flex() | 599 | .flex() |
| 592 | .flex_row() | 600 | .flex_row() |
| 593 | - .items_baseline() | 601 | + .items_center() |
| 594 | .gap(px(8.)) | 602 | .gap(px(8.)) |
| 595 | .child(ink(last.clone(), INK1())) | 603 | .child(ink(last.clone(), INK1())) |
| 596 | .when_some(parts.key.clone(), |row, text| { | 604 | .when_some(parts.key.clone(), |row, text| { |
| @@ -623,6 +631,10 @@ fn tip_card(parts: &TipParts, window: Option<&Window>) -> Div { | |||
| 623 | .map(|l| { | 631 | .map(|l| { |
| 624 | let l = l.clone(); | 632 | let l = l.clone(); |
| 625 | div() | 633 | div() |
| 634 | + .h(px(TIP_LINE_PX)) | ||
| 635 | + .line_height(px(TIP_LINE_PX)) | ||
| 636 | + .flex() | ||
| 637 | + .items_center() | ||
| 626 | .whitespace_nowrap() | 638 | .whitespace_nowrap() |
| 627 | .font(name.font.clone()) | 639 | .font(name.font.clone()) |
| 628 | .text_size(name.size) | 640 | .text_size(name.size) |
crates/engine/src/playback.rsmodified+4 -4
| @@ -1013,7 +1013,7 @@ impl PlaybackSession { | |||
| 1013 | drop_late: false, | 1013 | drop_late: false, |
| 1014 | // A file just opened is a project nobody has picked stand-ins for. | 1014 | // A file just opened is a project nobody has picked stand-ins for. |
| 1015 | proxies: false, | 1015 | proxies: false, |
| 1016 | - auto_proxies: true, | 1016 | + auto_proxies: false, |
| 1017 | encoder_seat: crate::export::EncoderSeat::default(), | 1017 | encoder_seat: crate::export::EncoderSeat::default(), |
| 1018 | sample_rate: None, | 1018 | sample_rate: None, |
| 1019 | }) | 1019 | }) |
| @@ -1109,7 +1109,7 @@ impl PlaybackSession { | |||
| 1109 | priming: false, | 1109 | priming: false, |
| 1110 | drop_late: false, | 1110 | drop_late: false, |
| 1111 | proxies: false, | 1111 | proxies: false, |
| 1112 | - auto_proxies: true, | 1112 | + auto_proxies: false, |
| 1113 | encoder_seat: crate::export::EncoderSeat::default(), | 1113 | encoder_seat: crate::export::EncoderSeat::default(), |
| 1114 | sample_rate: None, | 1114 | sample_rate: None, |
| 1115 | }) | 1115 | }) |
| @@ -1238,7 +1238,7 @@ impl PlaybackSession { | |||
| 1238 | drop_late: false, | 1238 | drop_late: false, |
| 1239 | // A file just opened is a project nobody has picked stand-ins for. | 1239 | // A file just opened is a project nobody has picked stand-ins for. |
| 1240 | proxies: false, | 1240 | proxies: false, |
| 1241 | - auto_proxies: true, | 1241 | + auto_proxies: false, |
| 1242 | encoder_seat: crate::export::EncoderSeat::default(), | 1242 | encoder_seat: crate::export::EncoderSeat::default(), |
| 1243 | sample_rate: None, | 1243 | sample_rate: None, |
| 1244 | }) | 1244 | }) |
| @@ -1365,7 +1365,7 @@ impl PlaybackSession { | |||
| 1365 | drop_late: false, | 1365 | drop_late: false, |
| 1366 | // A file just opened is a project nobody has picked stand-ins for. | 1366 | // A file just opened is a project nobody has picked stand-ins for. |
| 1367 | proxies: false, | 1367 | proxies: false, |
| 1368 | - auto_proxies: true, | 1368 | + auto_proxies: false, |
| 1369 | encoder_seat: crate::export::EncoderSeat::default(), | 1369 | encoder_seat: crate::export::EncoderSeat::default(), |
| 1370 | sample_rate: None, | 1370 | sample_rate: None, |
| 1371 | }) | 1371 | }) |
crates/engine/src/project.rsmodified+4 -2
| @@ -2329,7 +2329,7 @@ impl ProjectSettings { | |||
| 2329 | encoder_seat: crate::export::EncoderSeat::default(), | 2329 | encoder_seat: crate::export::EncoderSeat::default(), |
| 2330 | sample_rate: None, | 2330 | sample_rate: None, |
| 2331 | proxies: false, | 2331 | proxies: false, |
| 2332 | - auto_proxies: true, | 2332 | + auto_proxies: false, |
| 2333 | tone: crate::tonemap::Preset::default(), | 2333 | tone: crate::tonemap::Preset::default(), |
| 2334 | limiter: Limiter::default(), | 2334 | limiter: Limiter::default(), |
| 2335 | caption_style: crate::captionanim::CaptionStyle::default(), | 2335 | caption_style: crate::captionanim::CaptionStyle::default(), |
| @@ -8857,8 +8857,10 @@ impl Project { | |||
| 8857 | // hole between it and what it was cut from closes behind it. | 8857 | // hole between it and what it was cut from closes behind it. |
| 8858 | let g = i64::from(new_start) - i64::from(old_start); | 8858 | let g = i64::from(new_start) - i64::from(old_start); |
| 8859 | if g != 0 { | 8859 | if g != 0 { |
| 8860 | - shift_behind(&mut self.lanes[l], old_end, -g); | 8860 | + // Back in place first: `shift_behind` checks the whole lane, and the clip |
| 8861 | + // still starting at the trimmed head would overlap what moves up. | ||
| 8861 | self.lanes[l].clips[i].start = old_start; | 8862 | self.lanes[l].clips[i].start = old_start; |
| 8863 | + shift_behind(&mut self.lanes[l], old_end, -g); | ||
| 8862 | } | 8864 | } |
| 8863 | } | 8865 | } |
| 8864 | Edge::End => { | 8866 | Edge::End => { |
crates/engine/tests/it/audio_streams.rsmodified+15 -1
| @@ -55,8 +55,22 @@ fn zero_crossings(samples: &[f32]) -> usize { | |||
| 55 | #[test] | 55 | #[test] |
| 56 | fn probe_streams_lists_every_audio_track_in_file_order() { | 56 | fn probe_streams_lists_every_audio_track_in_file_order() { |
| 57 | let streams = AudioSession::probe_streams(asset(MULTI)).expect("probes"); | 57 | let streams = AudioSession::probe_streams(asset(MULTI)).expect("probes"); |
| 58 | + // The bitrates are the encoder's output, and the fixtures are regenerated | ||
| 59 | + // with whatever ffmpeg is installed, so each is held to within 5 % of the | ||
| 60 | + // value it was last measured at rather than to the exact figure. The rest | ||
| 61 | + // of every row is compared exactly below. | ||
| 62 | + let mut shape = streams.clone(); | ||
| 63 | + for (s, want) in shape.iter_mut().zip([128_372u64, 62_612, 193_928]) { | ||
| 64 | + let got = s.bitrate.expect("a bitrate"); | ||
| 65 | + assert!( | ||
| 66 | + got.abs_diff(want) * 20 <= want, | ||
| 67 | + "stream {}: bitrate {got} is more than 5% from {want}", | ||
| 68 | + s.index | ||
| 69 | + ); | ||
| 70 | + s.bitrate = Some(want); | ||
| 71 | + } | ||
| 58 | assert_eq!( | 72 | assert_eq!( |
| 59 | - streams, | 73 | + shape, |
| 60 | vec![ | 74 | vec![ |
| 61 | StreamInfo { | 75 | StreamInfo { |
| 62 | index: 0, | 76 | index: 0, |
crates/engine/tests/it/bitrate.rsmodified+37 -4
| @@ -170,14 +170,40 @@ fn a_stream_the_container_states_is_stated_and_no_stream_is_invented() { | |||
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | +/// The picture's bits per second as `ffprobe` reads it off the file: the video | ||
| 174 | +/// packets' bytes over `format=duration`, both taken from the file and neither | ||
| 175 | +/// from the probe under test. | ||
| 176 | +fn ffprobe_picture_bps(name: &str) -> u64 { | ||
| 177 | + let run = |entries: &[&str]| { | ||
| 178 | + let out = std::process::Command::new("ffprobe") | ||
| 179 | + .args(["-v", "error"]) | ||
| 180 | + .args(entries) | ||
| 181 | + .arg(asset(name)) | ||
| 182 | + .output() | ||
| 183 | + .expect("ffprobe runs"); | ||
| 184 | + String::from_utf8(out.stdout).expect("ffprobe prints utf-8") | ||
| 185 | + }; | ||
| 186 | + let bytes: u64 = run(&["-select_streams", "v", "-show_entries", "packet=size", "-of", "csv=p=0"]) | ||
| 187 | + .lines() | ||
| 188 | + .filter(|l| !l.trim().is_empty()) | ||
| 189 | + .map(|l| l.trim().parse::<u64>().expect("a packet size")) | ||
| 190 | + .sum(); | ||
| 191 | + let secs: f64 = run(&["-show_entries", "format=duration", "-of", "csv=p=0"]) | ||
| 192 | + .trim() | ||
| 193 | + .parse() | ||
| 194 | + .expect("a duration"); | ||
| 195 | + (bytes as f64 * 8.0 / secs).round() as u64 | ||
| 196 | +} | ||
| 197 | + | ||
| 173 | #[test] | 198 | #[test] |
| 174 | fn a_matroska_states_its_sound_too_and_its_picture_is_unchanged() { | 199 | fn a_matroska_states_its_sound_too_and_its_picture_is_unchanged() { |
| 175 | // Both mkv fixtures carry `-c:a aac -b:a 128k` (`gen_fixtures.sh:158,223`), | 200 | // Both mkv fixtures carry `-c:a aac -b:a 128k` (`gen_fixtures.sh:158,223`), |
| 176 | // so an absent audio row here is a missing measurement, not a silent file -- | 201 | // so an absent audio row here is a missing measurement, not a silent file -- |
| 177 | // and a film library is overwhelmingly Matroska, so this is the common case. | 202 | // and a film library is overwhelmingly Matroska, so this is the common case. |
| 178 | // | 203 | // |
| 179 | - // The video numbers are pinned so that adding the sound track to the walk | 204 | + // The picture is checked against what ffprobe reads from the file itself, |
| 180 | - // cannot move the picture. The numerator is the one `ffprobe | 205 | + // so that adding the sound track to the walk cannot move it, and so that |
| 206 | + // the fixtures can be regenerated without this test caring. The numerator is the one `ffprobe | ||
| 181 | // -select_streams v -show_entries packet=size` sums independently -- 716 834 | 207 | // -select_streams v -show_entries packet=size` sums independently -- 716 834 |
| 182 | // bytes for test_av1.mkv. The denominator is `Info.Duration`, **2.023 s**, | 208 | // bytes for test_av1.mkv. The denominator is `Info.Duration`, **2.023 s**, |
| 183 | // not the picture's own 2.000 s: the AAC track outlasts the last frame by | 209 | // not the picture's own 2.000 s: the AAC track outlasts the last frame by |
| @@ -185,10 +211,17 @@ fn a_matroska_states_its_sound_too_and_its_picture_is_unchanged() { | |||
| 185 | // These were 2_867_336 / 2_086_260 while the divisor was the video track, | 211 | // These were 2_867_336 / 2_086_260 while the divisor was the video track, |
| 186 | // i.e. 1.1 % high, which is the same defect the lopsided fixture shows at | 212 | // i.e. 1.1 % high, which is the same defect the lopsided fixture shows at |
| 187 | // 30x. | 213 | // 30x. |
| 188 | - for (name, video_bps) in [("test_av1.mkv", 2_834_736), ("test_hevc.mkv", 2_062_540)] { | 214 | + for name in ["test_av1.mkv", "test_hevc.mkv"] { |
| 189 | let rate = probe_bitrate(&asset(name)); | 215 | let rate = probe_bitrate(&asset(name)); |
| 190 | no_field_is_zero(name, rate); | 216 | no_field_is_zero(name, rate); |
| 191 | - assert_eq!(rate.video, Some(video_bps), "{name}: picture moved"); | 217 | + // A tenth of a percent is the probe's integer rounding and nothing |
| 218 | + // more. The 1.1 % divisor error this guards against is well outside it. | ||
| 219 | + let expected = ffprobe_picture_bps(name); | ||
| 220 | + let video = rate.video.unwrap_or_else(|| panic!("{name}: no picture rate")); | ||
| 221 | + assert!( | ||
| 222 | + video.abs_diff(expected) * 1000 <= expected, | ||
| 223 | + "{name}: picture moved: {video} bps, ffprobe reads {expected}" | ||
| 224 | + ); | ||
| 192 | let audio = rate | 225 | let audio = rate |
| 193 | .audio | 226 | .audio |
| 194 | .unwrap_or_else(|| panic!("{name}: no audio rate, and it has a 128k AAC track")); | 227 | .unwrap_or_else(|| panic!("{name}: no audio rate, and it has a 128k AAC track")); |
crates/engine/tests/it/display_unit.rsmodified+7 -3
| @@ -121,7 +121,10 @@ fn video_unit_3(dar_width: u16, dar_height: u16, coded_width: u16, coded_height: | |||
| 121 | ) | 121 | ) |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | -fn with_video_element(source: &Path, into: &Path, element: &str) { | 124 | +/// Patches the `Video` element into a copy of `source` and returns the byte |
| 125 | +/// offset it was written at, found by scanning the source rather than | ||
| 126 | +/// assumed, since the offset depends on the muxer's layout. | ||
| 127 | +fn with_video_element(source: &Path, into: &Path, element: &str) -> usize { | ||
| 125 | let from = hex(VIDEO_UNIT_3); | 128 | let from = hex(VIDEO_UNIT_3); |
| 126 | let to = hex(element); | 129 | let to = hex(element); |
| 127 | assert_eq!( | 130 | assert_eq!( |
| @@ -139,6 +142,7 @@ fn with_video_element(source: &Path, into: &Path, element: &str) { | |||
| 139 | let mut patched = bytes.clone(); | 142 | let mut patched = bytes.clone(); |
| 140 | patched[at..at + from.len()].copy_from_slice(&to); | 143 | patched[at..at + from.len()].copy_from_slice(&to); |
| 141 | std::fs::write(into, patched).expect("write the patched fixture"); | 144 | std::fs::write(into, patched).expect("write the patched fixture"); |
| 145 | + at | ||
| 142 | } | 146 | } |
| 143 | 147 | ||
| 144 | fn hex(text: &str) -> Vec<u8> { | 148 | fn hex(text: &str) -> Vec<u8> { |
| @@ -166,7 +170,7 @@ fn reduced(aspect: PixelAspect) -> (u32, u32) { | |||
| 166 | fn a_display_unit_of_zero_states_the_stretch_in_pixels() { | 170 | fn a_display_unit_of_zero_states_the_stretch_in_pixels() { |
| 167 | let scratch = Scratch::new("pixels"); | 171 | let scratch = Scratch::new("pixels"); |
| 168 | let unit0 = scratch.path("display_unit0.mkv"); | 172 | let unit0 = scratch.path("display_unit0.mkv"); |
| 169 | - with_video_element(&asset("test_anamorphic.mkv"), &unit0, VIDEO_UNIT_0); | 173 | + let aimed_at = with_video_element(&asset("test_anamorphic.mkv"), &unit0, VIDEO_UNIT_0); |
| 170 | 174 | ||
| 171 | // The patch landed, and it landed on a file the demuxer opens. | 175 | // The patch landed, and it landed on a file the demuxer opens. |
| 172 | let patched = std::fs::read(&unit0).expect("read back the patched fixture"); | 176 | let patched = std::fs::read(&unit0).expect("read back the patched fixture"); |
| @@ -181,7 +185,7 @@ fn a_display_unit_of_zero_states_the_stretch_in_pixels() { | |||
| 181 | patched | 185 | patched |
| 182 | .windows(wanted.len()) | 186 | .windows(wanted.len()) |
| 183 | .position(|window| window == wanted), | 187 | .position(|window| window == wanted), |
| 184 | - Some(369), | 188 | + Some(aimed_at), |
| 185 | "the DisplayUnit-0 element is where it was aimed" | 189 | "the DisplayUnit-0 element is where it was aimed" |
| 186 | ); | 190 | ); |
| 187 | 191 | ||
crates/engine/tests/it/saveload.rsmodified+2 -6
| @@ -100,18 +100,14 @@ fn a_picked_audio_stream_lands_saves_and_comes_back() { | |||
| 100 | 100 | ||
| 101 | /// Both stand-in switches through the front door: what the picture is cut on | 101 | /// Both stand-in switches through the front door: what the picture is cut on |
| 102 | /// and whether an import makes one at all are two settings, saved and reopened | 102 | /// and whether an import makes one at all are two settings, saved and reopened |
| 103 | -/// as the pair they are -- and a session that was never told keeps making them, | 103 | +/// as the pair they are -- and a fresh session makes none until it is told to. |
| 104 | -/// which is what every project did before there was a switch. | ||
| 105 | #[test] | 104 | #[test] |
| 106 | fn both_proxy_switches_survive_a_save_and_a_reopen() { | 105 | fn both_proxy_switches_survive_a_save_and_a_reopen() { |
| 107 | let dir = scratch("proxyswitches"); | 106 | let dir = scratch("proxyswitches"); |
| 108 | let media = copy_in(&dir, "test_av.mp4"); | 107 | let media = copy_in(&dir, "test_av.mp4"); |
| 109 | let mut session = PlaybackSession::open(&media).expect("open the fixture"); | 108 | let mut session = PlaybackSession::open(&media).expect("open the fixture"); |
| 110 | session.set_gain(0.0); | 109 | session.set_gain(0.0); |
| 111 | - assert!( | 110 | + assert!(!session.auto_proxies(), "a fresh project makes none by itself"); |
| 112 | - session.auto_proxies(), | ||
| 113 | - "a fresh project makes them by itself" | ||
| 114 | - ); | ||
| 115 | assert!(!session.proxies(), "and is cut on the film itself"); | 111 | assert!(!session.proxies(), "and is cut on the film itself"); |
| 116 | 112 | ||
| 117 | session.set_proxies(true); | 113 | session.set_proxies(true); |
crates/engine/tests/it/voice_audio.rsmodified+1 -1
| @@ -55,7 +55,7 @@ fn clip(source: usize, frames: u32) -> Clip { | |||
| 55 | fn noise(i: usize, rms: f32) -> f32 { | 55 | fn noise(i: usize, rms: f32) -> f32 { |
| 56 | let mut sum = 0.0f32; | 56 | let mut sum = 0.0f32; |
| 57 | for k in 0..4u64 { | 57 | for k in 0..4u64 { |
| 58 | - let mut x = (i as u64).wrapping_mul(0x9E37_79B9_7F4A_7C15).wrapping_add(k * 0xD1B5_4A32_D192_ED03); | 58 | + let mut x = (i as u64).wrapping_mul(0x9E37_79B9_7F4A_7C15).wrapping_add(k.wrapping_mul(0xD1B5_4A32_D192_ED03)); |
| 59 | x ^= x >> 29; | 59 | x ^= x >> 29; |
| 60 | x = x.wrapping_mul(0xBF58_476D_1CE4_E5B9); | 60 | x = x.wrapping_mul(0xBF58_476D_1CE4_E5B9); |
| 61 | x ^= x >> 32; | 61 | x ^= x >> 32; |
crates/mcp/src/tools/listen.rsmodified+1 -1
| @@ -4196,7 +4196,7 @@ mod tests { | |||
| 4196 | assert!(!fix.is_error, "{}", fix.text); | 4196 | assert!(!fix.is_error, "{}", fix.text); |
| 4197 | let scope = [Lane::new(LaneKind::Video, 1)]; | 4197 | let scope = [Lane::new(LaneKind::Video, 1)]; |
| 4198 | assert_eq!(srv.session.as_ref().unwrap().gap_count(scope[0]), 1, "the fixture leaves a one-frame hole"); | 4198 | assert_eq!(srv.session.as_ref().unwrap().gap_count(scope[0]), 1, "the fixture leaves a one-frame hole"); |
| 4199 | - let cut = cut_spans(&mut srv, &[(100, 2)], false, "sliver", &scope, &json!({}), false).expect("a cut"); | 4199 | + let cut = cut_spans(&mut srv, &[(100, 102)], false, "sliver", &scope, &json!({}), false).expect("a cut"); |
| 4200 | assert!(cut.ripple.contains("closed 1 hole(s) under 4f on V2"), "{}", cut.ripple); | 4200 | assert!(cut.ripple.contains("closed 1 hole(s) under 4f on V2"), "{}", cut.ripple); |
| 4201 | assert_eq!(srv.session.as_ref().unwrap().gap_count(scope[0]), 0, "{}", cut.ripple); | 4201 | assert_eq!(srv.session.as_ref().unwrap().gap_count(scope[0]), 0, "{}", cut.ripple); |
| 4202 | } | 4202 | } |
crates/mcp/src/tools/media.rsmodified+19 -4
| @@ -2491,20 +2491,35 @@ mod agreement_tests { | |||
| 2491 | #[test] | 2491 | #[test] |
| 2492 | fn an_edith_project_is_named_as_one_in_probe_and_import() { | 2492 | fn an_edith_project_is_named_as_one_in_probe_and_import() { |
| 2493 | quiet(); | 2493 | quiet(); |
| 2494 | - let row = probe_one(&asset("test_h264.edith")); | 2494 | + // A real project, saved by the tools into the test's own dir, so no fixture is needed on disk. |
| 2495 | + let td = TestDir::new("edith-project"); | ||
| 2496 | + let project = td.path().join("test_h264.edith"); | ||
| 2497 | + let tools = crate::server::tools(); | ||
| 2498 | + let mut maker = Server::new(); | ||
| 2499 | + let mut run = |name: &str, args: Value| { | ||
| 2500 | + let tool = tools.iter().find(|t| t.name == name).expect("tool"); | ||
| 2501 | + (tool.run)(&mut maker, &args) | ||
| 2502 | + }; | ||
| 2503 | + assert!(!run("project_new", json!({"path": project, "resolution": "1280x720"})).is_error); | ||
| 2504 | + let media = vec![asset("test_h264.mkv").display().to_string()]; | ||
| 2505 | + assert!(!run("media_import", json!({"paths": media})).is_error); | ||
| 2506 | + let saved = run("project_save", json!({})); | ||
| 2507 | + assert!(!saved.is_error, "{}", saved.text); | ||
| 2508 | + let path_arg = json!({"paths": [project.display().to_string()]}); | ||
| 2509 | + | ||
| 2510 | + let row = probe_one(&project); | ||
| 2495 | let line = row_line(&row); | 2511 | let line = row_line(&row); |
| 2496 | assert_eq!(line, "test_h264.edith · an edith project (open it with project_open)"); | 2512 | assert_eq!(line, "test_h264.edith · an edith project (open it with project_open)"); |
| 2497 | assert!(!line.contains("error"), "{line}"); | 2513 | assert!(!line.contains("error"), "{line}"); |
| 2498 | assert!(!line.contains("truncated"), "{line}"); | 2514 | assert!(!line.contains("truncated"), "{line}"); |
| 2499 | // Not a failed probe: the reply is not an error, and the row carries no error. | 2515 | // Not a failed probe: the reply is not an error, and the row carries no error. |
| 2500 | - let probed = probe(&mut Server::new(), &json!({"paths": [asset("test_h264.edith").display().to_string()]})); | 2516 | + let probed = probe(&mut Server::new(), &path_arg); |
| 2501 | assert!(!probed.is_error, "{}", probed.text); | 2517 | assert!(!probed.is_error, "{}", probed.text); |
| 2502 | assert_eq!(probed.text, line); | 2518 | assert_eq!(probed.text, line); |
| 2503 | assert_eq!(row_json(&row)["error"], json!(null)); | 2519 | assert_eq!(row_json(&row)["error"], json!(null)); |
| 2504 | - let td = TestDir::new("edith-import"); | ||
| 2505 | let mut server = Server::new(); | 2520 | let mut server = Server::new(); |
| 2506 | server.session = Some(PlaybackSession::empty(1280, 720, 30.0).unwrap()); | 2521 | server.session = Some(PlaybackSession::empty(1280, 720, 30.0).unwrap()); |
| 2507 | - let imported = import(&mut server, &json!({"paths": [asset("test_h264.edith").display().to_string()]})); | 2522 | + let imported = import(&mut server, &path_arg); |
| 2508 | assert!(imported.is_error, "{}", imported.text); | 2523 | assert!(imported.is_error, "{}", imported.text); |
| 2509 | assert!( | 2524 | assert!( |
| 2510 | imported.text.contains("test_h264.edith is an edith project, not media: open it with project_open"), | 2525 | imported.text.contains("test_h264.edith is an edith project, not media: open it with project_open"), |