forge
Explore
Log in

Don't you dare go Hollow

The floor, the notices and the silent refusals

Browse files at this commit

2c8e3aa151eb0ab655f319f6cdc69a4f66f2b3ffAhmet Kaan GümüşParent: 2171351
  • feat
    • the floor, the notices and the silent refusals
Show full message
✨ feat(ui): the floor, the notices and the silent refusals

The transient bars hang off the bottom of the picture instead of taking a row
of the column -- a notice arriving used to push the transport, the toolbar and
the timeline down by its own height, which is every control below it moving
with state.

At 640x360 the timeline takes at most its share of the window and its lanes
scroll inside it, the library tabs wrap rather than hanging off the panel, and
the level's bar stands down while its button and its keys stay.

A class refusal (esc with nothing exporting) is silent; a state refusal speaks.
crates/app/src/main.rsmodified+56 -17
@@ -1620,10 +1620,19 @@ impl Player {
1620 // same controls sat dim and *dead* to the pointer. Whatever refuses the1620 // same controls sat dim and *dead* to the pointer. Whatever refuses the
1621 // button refuses the key, in the oracle's own words -- and a refusal1621 // button refuses the key, in the oracle's own words -- and a refusal
1622 // that is silent from the keyboard is a bug the same size.1622 // that is silent from the keyboard is a bug the same size.
1623- if let Some(why) = self.enable(action, None).why() {1623+ match self.enable(action, None) {
1624- self.notice = Some(format!("{} — {why}", action.label()).into());1624+ Enable::Yes => {}
1625- cx.notify();1625+ // A state refusal is spoken: the thing exists and cannot happen
1626- return;1626+ // *now*, which is exactly what a silent key press fails to say.
1627+ Enable::No(why) => {
1628+ self.notice = Some(format!("{} — {why}", action.label()).into());
1629+ cx.notify();
1630+ return;
1631+ }
1632+ // A class refusal is not: the action does not exist for what is in
1633+ // front of the user, and `esc` with nothing exporting must not
1634+ // answer with a line about exports.
1635+ Enable::Hidden(_) => return,
1627 }1636 }
1628 match action {1637 match action {
1629 ActionId::Play => self.toggle_or_restart(cx),1638 ActionId::Play => self.toggle_or_restart(cx),
@@ -5844,25 +5853,47 @@ impl Render for Player {
5844 )5853 )
5845 // After the picture, so the plate is drawn5854 // After the picture, so the plate is drawn
5846 // over it rather than under.5855 // over it rather than under.
5847- .children(self.subtitle_overlay(position, window)),5856+ .children(self.subtitle_overlay(position, window))
5857+ // The three transient lines hang off the
5858+ // bottom of the picture rather than taking
5859+ // a row of the column: a notice that
5860+ // arrives must not push the transport, the
5861+ // toolbar and the timeline down by its own
5862+ // height -- which is a control moving with
5863+ // state, on every control below it at once.
5864+ .child(
5865+ div()
5866+ .absolute()
5867+ .bottom_0()
5868+ .left_0()
5869+ .right_0()
5870+ .flex()
5871+ .flex_col()
5872+ .gap(px(2.))
5873+ .children(self.import_bar(cx))
5874+ .children(self.seek_bar())
5875+ .children(self.notice_bar(cx)),
5876+ ),
5848 )5877 )
5849- .child(self.transport_bar(position, state, cx)),5878+ .child(self.transport_bar(
5879+ position,
5880+ state,
5881+ f32::from(window.viewport_size().width),
5882+ cx,
5883+ )),
5850 )5884 )
5851 // The settings cards live in here rather than over the5885 // The settings cards live in here rather than over the
5852 // timeline: adjusting a clip must not hide the clip.5886 // timeline: adjusting a clip must not hide the clip.
5853 .child(self.inspector(window.viewport_size(), cx)),5887 .child(self.inspector(window.viewport_size(), cx)),
5854 )5888 )
5855- // Above the toolbar and only when there is one to show, so it costs
5856- // the picture nothing the rest of the time. The import's line sits
5857- // over the notice's: a notice is about something that has already
5858- // happened, and this is about something still happening.
5859- .children(self.import_bar(cx))
5860- // The same slot and the same reason: work still going on, said out
5861- // loud because a still picture is the only other evidence of it.
5862- .children(self.seek_bar())
5863- .children(self.notice_bar(cx))
5864 .child(self.toolbar(cx))5889 .child(self.toolbar(cx))
5865- .child(self.timeline(position, duration, state, cx))5890+ .child(self.timeline(
5891+ position,
5892+ duration,
5893+ state,
5894+ f32::from(window.viewport_size().height),
5895+ cx,
5896+ ))
5866 // Over the region they were opened on, and under the modal cards:5897 // Over the region they were opened on, and under the modal cards:
5867 // they are only ever up while none of those is (`modal`).5898 // they are only ever up while none of those is (`modal`).
5868 .children(self.context_card(window.viewport_size(), cx))5899 .children(self.context_card(window.viewport_size(), cx))
@@ -6902,7 +6933,10 @@ fn enable(action: ActionId, ctx: Ctx) -> Enable {
6902 ActionId::ToggleSubtitles | ActionId::RemoveSubtitleTrack if !ctx.subtitles => {6933 ActionId::ToggleSubtitles | ActionId::RemoveSubtitleTrack if !ctx.subtitles => {
6903 Enable::No("no subtitles yet")6934 Enable::No("no subtitles yet")
6904 }6935 }
6905- ActionId::CancelExport => Enable::No("nothing is exporting"),6936+ // Not `No`: with nothing running there is no export for this to be
6937+ // about at all, which is what keeps `esc` -- the same key -- a quiet
6938+ // way out of a card rather than a line about exports.
6939+ ActionId::CancelExport => Enable::Hidden("nothing is exporting"),
6906 // A clock started against an empty timeline is a clock counting6940 // A clock started against an empty timeline is a clock counting
6907 // nothing: the transport says so by being dim, which is what its own6941 // nothing: the transport says so by being dim, which is what its own
6908 // ad-hoc boolean used to say before the oracle knew the question.6942 // ad-hoc boolean used to say before the oracle knew the question.
@@ -8293,6 +8327,11 @@ fn timeline_h(lanes: usize) -> f32 {
8293 /// cannot push a lane off the bottom.8327 /// cannot push a lane off the bottom.
8294 const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.;8328 const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.;
8295 8329
8330+/// The most of a short window the timeline may take. At the 640x360 floor that
8331+/// is 151 px of the 360, which leaves the picture a region rather than a
8332+/// letterbox stripe -- and the lanes scroll inside it.
8333+const TIMELINE_SHARE: f32 = 0.42;
8334+
8296 /// The edit toolbar directly above the timeline: one control's height in its8335 /// The edit toolbar directly above the timeline: one control's height in its
8297 /// own padding, fixed so nothing in it can push the timeline down.8336 /// own padding, fixed so nothing in it can push the timeline down.
8298 const TOOLBAR_H: f32 = CONTROL_H + 16.;8337 const TOOLBAR_H: f32 = CONTROL_H + 16.;
crates/app/src/ui/library.rsmodified+14 -2
@@ -231,6 +231,11 @@ impl Player {
231 .flex_1()231 .flex_1()
232 .min_w(px(0.))232 .min_w(px(0.))
233 .flex()233 .flex()
234+ // Wraps rather than clipping: at the 640 px floor
235+ // this column is 128 px wide and the third tab
236+ // would hang off its edge, which is a control the
237+ // pointer cannot reach.
238+ .flex_wrap()
234 .gap(px(2.))239 .gap(px(2.))
235 .children(LIBRARY_TABS.map(|tab| {240 .children(LIBRARY_TABS.map(|tab| {
236 let on = tab == self.library_tab;241 let on = tab == self.library_tab;
@@ -264,9 +269,16 @@ impl Player {
264 .child(tab.label())269 .child(tab.label())
265 })),270 })),
266 )271 )
267- .child(control(272+ ,
273+ )
274+ .child(
275+ div().flex_none().child(control(
268 "import",276 "import",
269- 0.,277+ // Full width of the column: the way media gets in is
278+ // the one affordance in this panel that is always
279+ // there, whatever tab is open and however narrow the
280+ // window is.
281+ width - 16.,
270 BG_RAISED,282 BG_RAISED,
271 None,283 None,
272 "Import",284 "Import",
crates/app/src/ui/overlays.rsmodified+3 -0
@@ -53,6 +53,9 @@ impl Player {
53 // Hugs its label: the bar's own line is what wants53 // Hugs its label: the bar's own line is what wants
54 // the width, and this button never relabels.54 // the width, and this button never relabels.
55 0.,55 0.,
56+ // The ordinary plane -- the accent is Export's, and
57+ // a way out of a read is not the primary action.
58+ BG_RAISED,
56 None,59 None,
57 "Cancel",60 "Cancel",
58 "stops this file and anything queued behind it; the read already \61 "stops this file and anything queued behind it; the read already \
crates/app/src/ui/timeline.rsmodified+11 -2
@@ -14,6 +14,7 @@ impl Player {
14 position: f64,14 position: f64,
15 duration: f64,15 duration: f64,
16 state: Transport,16 state: Transport,
17+ viewport_h: f32,
17 cx: &mut Context<Self>,18 cx: &mut Context<Self>,
18 ) -> impl IntoElement {19 ) -> impl IntoElement {
19 // Where the playhead is *on the bed*, in pixels from its left edge.20 // Where the playhead is *on the bed*, in pixels from its left edge.
@@ -100,7 +101,10 @@ impl Player {
100 };101 };
101 div()102 div()
102 .flex_none()103 .flex_none()
103- .h(px(timeline_h(lanes.len()) + strip_h))104+ // Never more than its share of a short window: the lane column
105+ // scrolls inside whatever it gets, and a timeline that pushes the
106+ // picture off the screen at the 640x360 floor is not a timeline.
107+ .h(px((timeline_h(lanes.len()) + strip_h).min(viewport_h * TIMELINE_SHARE)))
104 .flex()108 .flex()
105 .flex_col()109 .flex_col()
106 .gap(px(8.))110 .gap(px(8.))
@@ -227,7 +231,12 @@ impl Player {
227 .child(231 .child(
228 div()232 div()
229 .id("lanes")233 .id("lanes")
230- .flex_none()234+ // Takes whatever the region has left and scrolls inside it:
235+ // at the 640x360 floor the region is capped
236+ // ([`TIMELINE_SHARE`]) and a fixed column would be clipped
237+ // by it rather than scrolled.
238+ .flex_1()
239+ .min_h(px(0.))
231 .flex()240 .flex()
232 .flex_col()241 .flex_col()
233 .gap(px(8.))242 .gap(px(8.))
crates/app/src/ui/toolbar.rsmodified+22 -7
@@ -131,9 +131,18 @@ impl Player {
131 &self,131 &self,
132 position: f64,132 position: f64,
133 state: Transport,133 state: Transport,
134+ viewport_w: f32,
134 cx: &mut Context<Self>,135 cx: &mut Context<Self>,
135 ) -> impl IntoElement {136 ) -> impl IntoElement {
136 let muted = self.volume.muted;137 let muted = self.volume.muted;
138+ // The room this strip actually has: the window less the two side
139+ // panels. At the 640 px floor that is ~300 px, which the clock and the
140+ // level together do not fit -- so the level's *bar* stands down (its
141+ // button, its keys and its row on the actions card all remain), and
142+ // the clock keeps a narrower rect rather than being pushed off.
143+ let room = viewport_w - library_w(viewport_w) - inspector_w(viewport_w);
144+ let clock_w = TIME_W.min(room - 140.).max(96.);
145+ let slider = room >= TRANSPORT_ROOMY;
137 div()146 div()
138 .flex_none()147 .flex_none()
139 .h(px(TRANSPORT_H))148 .h(px(TRANSPORT_H))
@@ -160,7 +169,7 @@ impl Player {
160 .child(169 .child(
161 div()170 div()
162 .flex_none()171 .flex_none()
163- .w(px(TIME_W))172+ .w(px(clock_w))
164 .truncate()173 .truncate()
165 .text_color(rgb(FG_PRIMARY))174 .text_color(rgb(FG_PRIMARY))
166 .child(format!(175 .child(format!(
@@ -201,12 +210,14 @@ impl Player {
201 true => STATUS_WARNING,210 true => STATUS_WARNING,
202 false => FG_PRIMARY,211 false => FG_PRIMARY,
203 }))212 }))
204- .child(volume_slider(213+ .when(slider, |d| {
205- self.volume,214+ d.child(volume_slider(
206- self.volume_bar.clone(),215+ self.volume,
207- self.enable(ActionId::ToggleMute, None).yes(),216+ self.volume_bar.clone(),
208- cx,217+ self.enable(ActionId::ToggleMute, None).yes(),
209- ))218+ cx,
219+ ))
220+ })
210 }221 }
211 222
212 /// The edit toolbar, directly above the timeline it acts on: split, delete,223 /// The edit toolbar, directly above the timeline it acts on: split, delete,
@@ -420,3 +431,7 @@ pub(crate) const ZOOM_SLOT_W: f32 = 76.;
420 pub(crate) const VOLUME_SLOT_W: f32 = 76.;431 pub(crate) const VOLUME_SLOT_W: f32 = 76.;
421 /// The HDR rendition's names are the longest words on any button here.432 /// The HDR rendition's names are the longest words on any button here.
422 pub(crate) const TONE_SLOT_W: f32 = 148.;433 pub(crate) const TONE_SLOT_W: f32 = 148.;
434+
435+/// The width the transport strip needs before the level's bar fits beside the
436+/// clock: play + clock + the mute button + the bar, in their gaps.
437+pub(crate) const TRANSPORT_ROOMY: f32 = 460.;