app: fill the screen with a clip in review
The review screen gave the clip a framed stage with the header, the details column and the status bar around it, so a clip watched there filled a fraction of the display. Full screen, the button beside the volume or F, hands the window to the display with no frame of ours and draws the picture alone, letterboxed at 16:9. The controls keep to a band at the bottom: a gradient no taller than they are, the scrubber with its event marks, the transport and an Exit full screen button. The band is its own hover group, so the pointer comes to it for the controls to draw in over 200 ms, and they are gone 400 ms after it leaves. Escape, the button or a double press on the picture leaves, and the double press enters from the windowed stage. Being full screen belongs to the window, not to the review, so App keeps the state it last asked of the window and poll reconciles the two: a way out of the review, a jump to another screen, or a window closed and reopened brings the title bar, the status bar and the frame back.
This commit is contained in:
1 parent
e546ab6969
commit
73b41fa86b
4 files changed
+184
-47
No files matched your search
+5
-1
@@ -29,6 +29,7 @@ cargo run -- --snap recording-live-delete.png --scene recording-live-delete
|
|||||||
cargo run -- --snap recording-idle.png --scene recording-idle
|
cargo run -- --snap recording-idle.png --scene recording-idle
|
||||||
cargo run -- --snap audio.png --scene audio
|
cargo run -- --snap audio.png --scene audio
|
||||||
cargo run -- --snap review.png --scene review
|
cargo run -- --snap review.png --scene review
|
||||||
|
cargo run -- --snap review-full.png --scene review-full # the picture alone, at rest
|
||||||
cargo run -- --snap clips.png --scene clips
|
cargo run -- --snap clips.png --scene clips
|
||||||
cargo run -- --snap clip.png --scene clip
|
cargo run -- --snap clip.png --scene clip
|
||||||
cargo run -- --snap clips-many.png --scene clips-many --at 1 # 36 demo clips, to see the scrollbar
|
cargo run -- --snap clips-many.png --scene clips-many --at 1 # 36 demo clips, to see the scrollbar
|
||||||
@@ -99,7 +100,10 @@ reading (`history::tests`), highlight clipping (`highlight::tests`) and formatti
|
|||||||
mpv's, the three options in TODO.txt still apply; `Player` is confined to `screens/review.rs`.
|
mpv's, the three options in TODO.txt still apply; `Player` is confined to `screens/review.rs`.
|
||||||
6. Game review: done. The clip fills the window at 16:9, with play/pause, +/-10 s, and a
|
6. Game review: done. The clip fills the window at 16:9, with play/pause, +/-10 s, and a
|
||||||
scrubber that marks every event; highlights (play, export) and the timeline sit in a side
|
scrubber that marks every event; highlights (play, export) and the timeline sit in a side
|
||||||
panel, one press away. ffmpeg exports each highlight.
|
panel, one press away. ffmpeg exports each highlight. The Full screen button beside the
|
||||||
|
volume, a double press on the picture, or F takes the whole display: the picture fills the
|
||||||
|
screen and the controls fade in over its bottom while the pointer is on them, gone 400 ms
|
||||||
|
after it leaves. Escape goes back.
|
||||||
7. Audio channels: the recorder writes one audio stream per source, and the review screen opens
|
7. Audio channels: the recorder writes one audio stream per source, and the review screen opens
|
||||||
one player per stream (`export::extract_tracks` copies each into the audio cache). Toggles
|
one player per stream (`export::extract_tracks` copies each into the audio cache). Toggles
|
||||||
under the transport mute a channel for listening, and clip and highlight exports mix only
|
under the transport mute a channel for listening, and clip and highlight exports mix only
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ pub struct App {
|
|||||||
pub sample: bool,
|
pub sample: bool,
|
||||||
/// The screens behind this one, oldest first: the back arrow returns through them.
|
/// The screens behind this one, oldest first: the back arrow returns through them.
|
||||||
pub behind: Vec<Screen>,
|
pub behind: Vec<Screen>,
|
||||||
|
/// Whether the window is full screen at the app's asking. The review asks for it, and a
|
||||||
|
/// window that disagrees follows it in the next poll.
|
||||||
|
pub window_full: bool,
|
||||||
pub settings_tab: SettingsTab,
|
pub settings_tab: SettingsTab,
|
||||||
pub dark: bool,
|
pub dark: bool,
|
||||||
pub daemon: Daemon,
|
pub daemon: Daemon,
|
||||||
@@ -202,6 +205,7 @@ impl App {
|
|||||||
let live = std::env::args().any(|arg| arg == "--live");
|
let live = std::env::args().any(|arg| arg == "--live");
|
||||||
let mut app = Self {
|
let mut app = Self {
|
||||||
sample: headless && !live,
|
sample: headless && !live,
|
||||||
|
window_full: false,
|
||||||
screen: Screen::History,
|
screen: Screen::History,
|
||||||
behind: Vec::new(),
|
behind: Vec::new(),
|
||||||
settings_tab: SettingsTab::Quick,
|
settings_tab: SettingsTab::Quick,
|
||||||
@@ -727,6 +731,9 @@ thread_local! {
|
|||||||
/// no picture. Reopening brings the same screen back, paused where it was.
|
/// no picture. Reopening brings the same screen back, paused where it was.
|
||||||
pub fn window_closed(app: &mut App, _tx: &mut Tx) {
|
pub fn window_closed(app: &mut App, _tx: &mut Tx) {
|
||||||
app.pause_playback();
|
app.pause_playback();
|
||||||
|
// The window comes back at its spec size, so a full screen review ends with it.
|
||||||
|
app.review.fullscreen = false;
|
||||||
|
app.window_full = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remember_window(handle: &rune::WindowHandle) {
|
pub fn remember_window(handle: &rune::WindowHandle) {
|
||||||
@@ -836,6 +843,17 @@ impl App {
|
|||||||
fn handle_poll(&mut self, t: f64, tx: &mut Tx) -> bool {
|
fn handle_poll(&mut self, t: f64, tx: &mut Tx) -> bool {
|
||||||
let mut changed = false;
|
let mut changed = false;
|
||||||
|
|
||||||
|
// Being full screen is a state of the window, not only of the review: the view drops
|
||||||
|
// the title bar and the status bar the moment the review asks for it, and the window
|
||||||
|
// follows in the same frame. Any way out of the review, or off the screen it was on,
|
||||||
|
// brings both back.
|
||||||
|
let full = self.screen == Screen::Review && self.review.fullscreen;
|
||||||
|
self.review.fullscreen = full;
|
||||||
|
if full != self.window_full {
|
||||||
|
self.window_full = full;
|
||||||
|
tx.toggle_full_screen();
|
||||||
|
}
|
||||||
|
|
||||||
for event in self.daemon.drain() {
|
for event in self.daemon.drain() {
|
||||||
changed = true;
|
changed = true;
|
||||||
match (event.request, event.result) {
|
match (event.request, event.result) {
|
||||||
@@ -1184,12 +1202,21 @@ pub fn on_key(app: &mut App, event: &KeyEvent, _tx: &mut Tx) -> bool {
|
|||||||
app.clips_menu_open = None;
|
app.clips_menu_open = None;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
// A full screen clip leaves the screen it fills before it leaves the screen.
|
||||||
|
(Key::Escape, _) if app.review.fullscreen => {
|
||||||
|
app.review.fullscreen = false;
|
||||||
|
true
|
||||||
|
}
|
||||||
(Key::Escape, _) if !app.behind.is_empty() => {
|
(Key::Escape, _) if !app.behind.is_empty() => {
|
||||||
app.menu_open = None;
|
app.menu_open = None;
|
||||||
app.clips_menu_open = None;
|
app.clips_menu_open = None;
|
||||||
app.back();
|
app.back();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
(Key::Text(t), false) if app.screen == Screen::Review && t.eq_ignore_ascii_case("f") => {
|
||||||
|
app.review.fullscreen = !app.review.fullscreen;
|
||||||
|
true
|
||||||
|
}
|
||||||
(Key::Text(t), true) if t.eq_ignore_ascii_case("r") => {
|
(Key::Text(t), true) if t.eq_ignore_ascii_case("r") => {
|
||||||
app.refresh_games();
|
app.refresh_games();
|
||||||
app.daemon.get_status();
|
app.daemon.get_status();
|
||||||
@@ -1400,6 +1427,11 @@ pub fn view(app: &App, cx: &mut Cx<App>) -> El {
|
|||||||
// Menus and dialogs cover the whole window, title bar and status bar included: the
|
// Menus and dialogs cover the whole window, title bar and status bar included: the
|
||||||
// history row menus, the add-application form and the delete confirmation.
|
// history row menus, the add-application form and the delete confirmation.
|
||||||
let mut overlays = Vec::new();
|
let mut overlays = Vec::new();
|
||||||
|
// A full screen review is the picture alone: the title bar and the status bar would draw
|
||||||
|
// on it, and the window has no frame to hold them.
|
||||||
|
if app.screen == Screen::Review && app.review.fullscreen {
|
||||||
|
return rune_kit::root(screens::review::fullscreen(app, p), overlays);
|
||||||
|
}
|
||||||
let content = match app.screen {
|
let content = match app.screen {
|
||||||
Screen::Settings => screens::settings::view(app, p),
|
Screen::Settings => screens::settings::view(app, p),
|
||||||
Screen::History => screens::history::view(app, p, &mut overlays),
|
Screen::History => screens::history::view(app, p, &mut overlays),
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ fn main() {
|
|||||||
app::demo_review(app);
|
app::demo_review(app);
|
||||||
app.review.show_details = true;
|
app.review.show_details = true;
|
||||||
}),
|
}),
|
||||||
|
("review-full", |app| {
|
||||||
|
app::demo_review(app);
|
||||||
|
app.review.fullscreen = true;
|
||||||
|
}),
|
||||||
("clips-empty", |app| {
|
("clips-empty", |app| {
|
||||||
app.jump(app::Screen::Clips);
|
app.jump(app::Screen::Clips);
|
||||||
app.clips.clear();
|
app.clips.clear();
|
||||||
|
|||||||
+143
-46
@@ -47,6 +47,9 @@ pub struct Review {
|
|||||||
/// move under the pointer.
|
/// move under the pointer.
|
||||||
pub frozen_window: Option<(f64, f64)>,
|
pub frozen_window: Option<(f64, f64)>,
|
||||||
pub show_details: bool,
|
pub show_details: bool,
|
||||||
|
/// The window fills the display and the picture fills the window, with the controls over
|
||||||
|
/// its bottom: entered from the transport, a double press on the picture, or F.
|
||||||
|
pub fullscreen: bool,
|
||||||
pub highlights: Vec<Highlight>,
|
pub highlights: Vec<Highlight>,
|
||||||
/// The clip being chosen on the scrubber, once the Clip button is pressed.
|
/// The clip being chosen on the scrubber, once the Clip button is pressed.
|
||||||
pub clip: Option<Clip>,
|
pub clip: Option<Clip>,
|
||||||
@@ -379,6 +382,7 @@ impl Default for Review {
|
|||||||
highlights: Vec::new(),
|
highlights: Vec::new(),
|
||||||
clip: None,
|
clip: None,
|
||||||
show_details: false,
|
show_details: false,
|
||||||
|
fullscreen: false,
|
||||||
export: None,
|
export: None,
|
||||||
export_note: None,
|
export_note: None,
|
||||||
error: None,
|
error: None,
|
||||||
@@ -501,6 +505,7 @@ pub fn leave(app: &mut App) {
|
|||||||
app.review.error = None;
|
app.review.error = None;
|
||||||
app.review.export_note = None;
|
app.review.export_note = None;
|
||||||
app.review.export = None;
|
app.review.export = None;
|
||||||
|
app.review.fullscreen = false;
|
||||||
}
|
}
|
||||||
/// Called from `poll` while the review screen is up.
|
/// Called from `poll` while the review screen is up.
|
||||||
/// Sound from a second player drifts from the pictures by a few milliseconds a minute. Past a
|
/// Sound from a second player drifts from the pictures by a few milliseconds a minute. Past a
|
||||||
@@ -709,6 +714,81 @@ pub fn view(app: &App, p: Paint) -> El {
|
|||||||
.child(body)
|
.child(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The picture filling the window, with the controls over its bottom. The picture is the whole
|
||||||
|
/// screen, so the controls keep to their band: the pointer finds them there, and 200 ms after it
|
||||||
|
/// arrives they draw in, 400 ms after it leaves they are gone again.
|
||||||
|
pub fn fullscreen(app: &App, p: Paint) -> El {
|
||||||
|
let stage = el()
|
||||||
|
.key("fullscreen-stage")
|
||||||
|
.w_full()
|
||||||
|
.h_full()
|
||||||
|
.fill(rune::Color::BLACK)
|
||||||
|
.center();
|
||||||
|
// A double press on the picture leaves the full screen, as it enters one. It sits on the
|
||||||
|
// picture, not the stage, so the controls over it keep their own presses.
|
||||||
|
let stage = match &app.review.player {
|
||||||
|
Some(player) => stage.child(
|
||||||
|
el().key("video")
|
||||||
|
.aspect_fit(16.0 / 9.0)
|
||||||
|
.video(player, SurfaceFit::Fill)
|
||||||
|
.on_double_press(|app: &mut App| app.review.fullscreen = false),
|
||||||
|
),
|
||||||
|
None => stage.child(
|
||||||
|
text(
|
||||||
|
app.review
|
||||||
|
.error
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "Loading the clip…".into()),
|
||||||
|
)
|
||||||
|
.key("stage-message")
|
||||||
|
.font(body(13.0))
|
||||||
|
.color(p.muted()),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
// A band on the bottom of the picture, not a sheet over all of it: the gradient reaches
|
||||||
|
// black under the transport and is already gone a hand's width above the scrubber, so the
|
||||||
|
// picture shows at its own brightness on every display. The band is the hover group, so the
|
||||||
|
// pointer has to come to the controls for them to show, and leaving them puts them away.
|
||||||
|
let band = col()
|
||||||
|
.key("fullscreen-controls")
|
||||||
|
.pin(Some(0.0), None, Some(0.0), Some(0.0))
|
||||||
|
.hover_group()
|
||||||
|
.hover_motion(
|
||||||
|
rune::Spring::smooth(0.2, 0.0),
|
||||||
|
rune::Spring::smooth(0.4, 0.0),
|
||||||
|
);
|
||||||
|
let mut controls = col()
|
||||||
|
.key("fullscreen-bar")
|
||||||
|
.w_full()
|
||||||
|
.gap(space::S2)
|
||||||
|
.px(space::S6)
|
||||||
|
.pt(space::S6)
|
||||||
|
.pb(space::S3)
|
||||||
|
.gradient(rune::Color::TRANSPARENT, rune::Color::BLACK.alpha(0.8))
|
||||||
|
.group_opacity(0.0, 1.0);
|
||||||
|
if let Some(game) = app.reviewed() {
|
||||||
|
controls = controls.child(scrubber(app, p, game));
|
||||||
|
}
|
||||||
|
controls = controls.child(
|
||||||
|
row()
|
||||||
|
.key("fullscreen-transport")
|
||||||
|
.w_full()
|
||||||
|
.center_y()
|
||||||
|
.gap(space::S2)
|
||||||
|
.child(playback(app, p))
|
||||||
|
.child(volume(app, p))
|
||||||
|
.child(el().grow(1.0))
|
||||||
|
.child(ui::button(
|
||||||
|
p,
|
||||||
|
"exit-fullscreen",
|
||||||
|
"Exit full screen",
|
||||||
|
false,
|
||||||
|
|app: &mut App| app.review.fullscreen = false,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
stage.child(band.child(controls))
|
||||||
|
}
|
||||||
|
|
||||||
/// The clip itself: the largest 16:9 box that fits, on black, with a message when there is no
|
/// The clip itself: the largest 16:9 box that fits, on black, with a message when there is no
|
||||||
/// file to play.
|
/// file to play.
|
||||||
fn video_stage(app: &App, p: Paint) -> El {
|
fn video_stage(app: &App, p: Paint) -> El {
|
||||||
@@ -720,7 +800,8 @@ fn video_stage(app: &App, p: Paint) -> El {
|
|||||||
.fill(rune::Color::BLACK)
|
.fill(rune::Color::BLACK)
|
||||||
.radius(radius::LG)
|
.radius(radius::LG)
|
||||||
.clip_soft(radius::LG)
|
.clip_soft(radius::LG)
|
||||||
.center();
|
.center()
|
||||||
|
.on_double_press(|app: &mut App| app.review.fullscreen = true);
|
||||||
|
|
||||||
match &app.review.player {
|
match &app.review.player {
|
||||||
Some(player) => stage.child(
|
Some(player) => stage.child(
|
||||||
@@ -782,6 +863,67 @@ fn transport(app: &App, p: Paint) -> El {
|
|||||||
.w_full()
|
.w_full()
|
||||||
.center_y()
|
.center_y()
|
||||||
.gap(space::S2)
|
.gap(space::S2)
|
||||||
|
.child(playback(app, p))
|
||||||
|
.child(volume(app, p))
|
||||||
|
.child(ui::button(
|
||||||
|
p,
|
||||||
|
"fullscreen",
|
||||||
|
"Full screen",
|
||||||
|
false,
|
||||||
|
|app: &mut App| app.review.fullscreen = true,
|
||||||
|
))
|
||||||
|
.child(el().grow(1.0));
|
||||||
|
if let Some(note) = &app.review.export_note {
|
||||||
|
bar = bar.child(
|
||||||
|
text(note.clone())
|
||||||
|
.key("export-note")
|
||||||
|
.font(body(11.5))
|
||||||
|
.color(p.muted()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let bar = bar
|
||||||
|
.child(ui::button(
|
||||||
|
p,
|
||||||
|
"clip",
|
||||||
|
"Clip",
|
||||||
|
app.review.clip.is_some(),
|
||||||
|
|app: &mut App| app.review.toggle_clip(),
|
||||||
|
))
|
||||||
|
.child(ui::button(
|
||||||
|
p,
|
||||||
|
"toggle-details",
|
||||||
|
&if app.review.show_details {
|
||||||
|
"Hide details".to_string()
|
||||||
|
} else {
|
||||||
|
format!("Highlights · {count}")
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
|app: &mut App| {
|
||||||
|
app.review.show_details = !app.review.show_details;
|
||||||
|
},
|
||||||
|
));
|
||||||
|
|
||||||
|
let mut column = col()
|
||||||
|
.key("transport-bar")
|
||||||
|
.w_full()
|
||||||
|
.gap(space::S2)
|
||||||
|
.child(bar);
|
||||||
|
if let Some(line) = channels(app, p) {
|
||||||
|
column = column.child(line);
|
||||||
|
}
|
||||||
|
if let Some(clip) = app.review.clip {
|
||||||
|
column = column.child(clip_row(app, p, clip));
|
||||||
|
}
|
||||||
|
column
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Back ten seconds, play or pause, forward ten, and the clock: the bar and the full screen
|
||||||
|
/// picture show the same controls.
|
||||||
|
fn playback(app: &App, p: Paint) -> El {
|
||||||
|
row()
|
||||||
|
.key("playback")
|
||||||
|
.center_y()
|
||||||
|
.gap(space::S2)
|
||||||
.child(ui::media_button(
|
.child(ui::media_button(
|
||||||
p,
|
p,
|
||||||
"rewind",
|
"rewind",
|
||||||
@@ -828,52 +970,7 @@ fn transport(app: &App, p: Paint) -> El {
|
|||||||
.font(type_::MONO_CAPTION)
|
.font(type_::MONO_CAPTION)
|
||||||
.color(p.muted()),
|
.color(p.muted()),
|
||||||
)
|
)
|
||||||
.child(volume(app, p))
|
|
||||||
.child(el().grow(1.0));
|
|
||||||
if let Some(note) = &app.review.export_note {
|
|
||||||
bar = bar.child(
|
|
||||||
text(note.clone())
|
|
||||||
.key("export-note")
|
|
||||||
.font(body(11.5))
|
|
||||||
.color(p.muted()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
let bar = bar
|
|
||||||
.child(ui::button(
|
|
||||||
p,
|
|
||||||
"clip",
|
|
||||||
"Clip",
|
|
||||||
app.review.clip.is_some(),
|
|
||||||
|app: &mut App| app.review.toggle_clip(),
|
|
||||||
))
|
|
||||||
.child(ui::button(
|
|
||||||
p,
|
|
||||||
"toggle-details",
|
|
||||||
&if app.review.show_details {
|
|
||||||
"Hide details".to_string()
|
|
||||||
} else {
|
|
||||||
format!("Highlights · {count}")
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
|app: &mut App| {
|
|
||||||
app.review.show_details = !app.review.show_details;
|
|
||||||
},
|
|
||||||
));
|
|
||||||
|
|
||||||
let mut column = col()
|
|
||||||
.key("transport-bar")
|
|
||||||
.w_full()
|
|
||||||
.gap(space::S2)
|
|
||||||
.child(bar);
|
|
||||||
if let Some(line) = channels(app, p) {
|
|
||||||
column = column.child(line);
|
|
||||||
}
|
|
||||||
if let Some(clip) = app.review.clip {
|
|
||||||
column = column.child(clip_row(app, p, clip));
|
|
||||||
}
|
|
||||||
column
|
|
||||||
}
|
|
||||||
|
|
||||||
/// One toggle per audio track, shown once the clip carries more than one. A track that is off
|
/// One toggle per audio track, shown once the clip carries more than one. A track that is off
|
||||||
/// is neither heard nor kept in an export.
|
/// is neither heard nor kept in an export.
|
||||||
fn channels(app: &App, p: Paint) -> Option<El> {
|
fn channels(app: &App, p: Paint) -> Option<El> {
|
||||||
|
|||||||
Reference in new issue
Block a user