diff --git a/apps/deckcraft-web/src/presenter.rs b/apps/deckcraft-web/src/presenter.rs index a906ec5b9..26040867a 100644 --- a/apps/deckcraft-web/src/presenter.rs +++ b/apps/deckcraft-web/src/presenter.rs @@ -171,7 +171,8 @@ impl Host for BrowserHost { } if let Some(popup) = state.popup.clone() { let token = state.token.clone(); - let sent = self.images.send(snapshot, &token, state.refresh_images, |delta, current_changed, next_changed| { + // P3(show-w8): ss.A11 + let sent = self.images.send_base(snapshot, &token, state.refresh_images, |delta, current_changed, next_changed| { send( &popup, &self.origin, diff --git a/crates/engine/src/cmd/design.rs b/crates/engine/src/cmd/design.rs index 0a1202f74..6f69fe897 100644 --- a/crates/engine/src/cmd/design.rs +++ b/crates/engine/src/cmd/design.rs @@ -85,13 +85,13 @@ pub fn specs() -> Vec { has_doc, header_footer ), - cmd!(noundo "view.slideMaster", "Slide Master", ["View", "Master Views"], None, "{master?: index, layout?: index}", has_doc, master_view), + cmd!(noundo "view.slideMaster", "Slide Master", ["View", "Master Views"], None, "{master?: index, layout?: index, toggle?: bool}", has_doc, master_view), cmd!( "view.handoutMaster", "Handout Master", ["View", "Master Views"], None, - "{} (creates the handout master with header, date, footer and page number if the deck has none)", + "{toggle?: bool} (creates the handout master with header, date, footer and page number if the deck has none)", has_doc, handout_view ), @@ -109,7 +109,7 @@ pub fn specs() -> Vec { "Notes Master", ["View", "Master Views"], None, - "{} (creates the notes master with header, date, slide image, notes body, footer and page number if the deck has none)", + "{toggle?: bool} (creates the notes master with header, date, slide image, notes body, footer and page number if the deck has none)", has_doc, notes_view ), @@ -308,3 +308,22 @@ mod tests; #[cfg(test)] mod browse_theme_tests; + +/// A master view whose shown state is shared by commands and the ribbon. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MasterView { + /// Any master view. + Slide, + /// The handout master view. + Handout, + /// The notes master view. + Notes, +} +/// Reports whether the requested master view is shown, or false without a document. +pub fn master_view_shown(s: &Session, which: MasterView) -> bool { + let _ = (s, which); + todo!("rb.A24") +} + +/// The supported slide dimensions in points. +pub const SLIDE_SIZE_RANGE: std::ops::RangeInclusive = 72.0..=4032.0; diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index cdf1acf1b..f403ca893 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -856,3 +856,21 @@ mod tests { let _ = std::fs::remove_dir_all(&dir); } } + +/// Reads through the common validated transport callbacks and parses the presentation. +/// Maps transport failures to the engine error type. +pub fn read_presentation_file_with(path: &str, metadata: M, read: R) -> crate::Result +where + M: FnOnce(&str) -> std::result::Result<(bool, u64), String>, + R: FnOnce(&str) -> std::result::Result, String>, +{ + let _ = (path, metadata, read); + todo!("sh.A27") +} + +/// Records the serialized snapshot as the saved state of its originating document. +/// Leaves later edits dirty and never switches or redirects a closed document. +pub fn mark_saved_snapshot(s: &mut Session, uid: u64, snapshot: std::sync::Arc, path: Option) -> Result<()> { + let _ = (s, uid, snapshot, path); + todo!("sh.A23") +} diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index f4c280d7d..e9aea9882 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -601,3 +601,9 @@ mod tests { assert_eq!(s.doc().unwrap().history.undo.len(), n); } } + +/// The supported paragraph spacing in points. +pub const PARAGRAPH_PT_RANGE: std::ops::RangeInclusive = 0.0..=1584.0; + +/// The supported text column counts. +pub const COLUMN_COUNT_RANGE: std::ops::RangeInclusive = 1..=16; diff --git a/crates/engine/src/io.rs b/crates/engine/src/io.rs index 9a98f62a0..03d8e9c6f 100644 --- a/crates/engine/src/io.rs +++ b/crates/engine/src/io.rs @@ -150,3 +150,14 @@ mod tests { let _ = std::fs::remove_dir_all(&base); } } + +/// Checks read access and regular-file metadata before reading through the callbacks. +/// Rejects metadata or returned bytes over 2 GiB, retaining the path in errors. +pub fn read_file_with(path: &str, metadata: M, read: R) -> Result, String> +where + M: FnOnce(&str) -> Result<(bool, u64), String>, + R: FnOnce(&str) -> Result, String>, +{ + let _ = (path, metadata, read); + todo!("sh.A26") +} diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 26b88ebfa..eb1ae5a85 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -915,3 +915,61 @@ mod soak_tests; mod tests; #[cfg(test)] mod tests_keys; + +/// The kind of atomic replacement in the current edited text body. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TextReplaceKind { + /// Typed input, including typed AutoCorrect. + Typed, + /// Live composition input. + Composing, + /// Committed composition input. + Committed, + /// Pasted text. + Pasted, + /// Deleted surrounding text, preserving live composition. + Deleted, +} + +/// The actual flattened inserted range and authoritative selection after replacement. +#[derive(Clone, Debug, PartialEq)] +pub struct TextReplaceResult { + /// The resulting inserted or marked character range. + pub range: std::ops::Range, + /// The complete authoritative text selection. + pub selection: TextSel, +} + +impl Session { + /// Atomically replaces character offsets in the current flattened edited body. + /// Restores text, selection, composition and history on error. + pub fn replace_text_range(&mut self, range: std::ops::Range, text: &str, kind: TextReplaceKind) -> Result { + let _ = (range, text, kind); + todo!("cv.A11") + } +} + +impl Session { + /// Opens an idempotent text edit boundary for the current document and target. + /// Includes any original composition snapshot without adding an undo entry. + pub fn begin_text_edit_session(&mut self) -> Result<()> { + todo!("cv.A12") + } +} + +impl Session { + /// Finishes the current text edit boundary, optionally restoring only its edits. + /// Never crosses a sealed document or target boundary. + pub fn finish_text_edit_session(&mut self, cancel: bool) -> Result<()> { + let _ = cancel; + todo!("cv.A12") + } +} + +impl Session { + /// Returns the generation of actual active-document transitions. + /// Same-active and invalid requests leave the generation unchanged. + pub fn active_generation(&self) -> u64 { + todo!("sh.A20") + } +} diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index bf195b9f8..dcf051672 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -601,3 +601,12 @@ impl Session { self.active().and_then(|d| d.shape(id)).is_some_and(|s| matches!(s.kind, ShapeKind::Picture { .. } | ShapeKind::Media(_))) } } + +impl Session { + /// Uses the canonical canvas transform hit for hover and press gestures. + /// Keeps ordinary document hits while suppressing transform re-hits on this route. + pub fn pointer_with_hit(&mut self, ev: crate::tools::PointerEvent, transform_hit: Option) -> crate::Result { + let _ = (ev, transform_hit); + todo!("cv.A13") + } +} diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index a5521d588..6831c20f3 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -7,9 +7,49 @@ use super::state::{FilePlace, FilePurpose, ImeDescriptorKey, ImeDestination, Ime #[cfg(not(target_arch = "wasm32"))] use super::updates_ui; use super::{ - AnimPreview, ControlRequest, FileTarget, HashMap, ImeCancelled, ImeComposition, ImeResetPhase, ImeTerminalPending, InputTarget, Mods, - PendingFile, Perf, Receiver, Session, SlideApp, Target, UI_COMMANDS, UiRequest, Value, backstage, canvas, capture, dialogs, doc_window, - eyedropper, json, media, menus, notes, panes, preview, qat, ribbon, selpane, show, sorter, status, textures, theme, thumbs, toast, uifonts, + AnimPreview, + ControlRequest, + FileTarget, + HashMap, + ImeCancelled, + ImeComposition, + ImeResetPhase, + ImeTerminalPending, + InputTarget, + Mods, + // P3(shell-w11): sh.A8 + PendingFileBase, + Perf, + Receiver, + Session, + SlideApp, + Target, + UI_COMMANDS, + UiRequest, + Value, + backstage, + canvas, + capture, + dialogs, + doc_window, + eyedropper, + json, + media, + menus, + notes, + panes, + preview, + qat, + ribbon, + selpane, + show, + sorter, + status, + textures, + theme, + thumbs, + toast, + uifonts, }; mod clipboard; @@ -76,6 +116,7 @@ impl SlideApp { // P3(shell-w11): sh.A8 clock: Default::default(), // P3(shell-w11): sh.A8 + #[cfg(not(target_arch = "wasm32"))] opening_jobs: Default::default(), // P3(shell-w11): dl.A1 dialogs: Default::default(), @@ -181,6 +222,8 @@ impl SlideApp { twisting: false, next_file_id: 1, pending_files: Vec::new(), + // P3(shell-w11): sh.A8 + pending_files_base: Vec::new(), host_start: None, ime_tracker: egui::ime_context::ImeContextTracker::new(), ime_pending: None, @@ -500,8 +543,34 @@ impl crate::SlideApp { impl SlideApp { /// Installs the runtime, app icons, fonts and looks, and opens the platform settings store. /// Keeps the installed host and builds spelling jobs over its shared job service. - pub fn new(ctx: &egui::Context, platform: crate::Platform) -> Result { + pub fn new(ctx: &egui::Context, platform: crate::Platform) -> Result { let _ = (ctx, platform); todo!("sh.A2") } } + +/// A startup failure while installing the runtime or building the command catalogue. +#[derive(Debug)] +#[non_exhaustive] +pub enum AppError { + /// The runtime could not be installed. + Install(craft::ui::runtime::InstallError), + /// The initial command catalogue could not be built. + Catalog(String), +} + +impl From for AppError { + fn from(error: craft::ui::runtime::InstallError) -> Self { + let _ = error; + todo!("sh.A2") + } +} +impl std::fmt::Display for AppError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let _ = f; + todo!("sh.A2") + } +} +impl std::error::Error for AppError {} + +pub(crate) use files::FileOperation; diff --git a/crates/ui-egui/src/app/catalog.rs b/crates/ui-egui/src/app/catalog.rs index 209deaf6d..1de5cbbd2 100644 --- a/crates/ui-egui/src/app/catalog.rs +++ b/crates/ui-egui/src/app/catalog.rs @@ -31,7 +31,7 @@ pub(crate) static DEFAULT_CHORDS: &[DefaultChord] = &[]; /// Builds the app command catalogue and its defaults. #[allow(dead_code)] // P3(shell-w4): sh.A15 -pub(crate) fn build(session: &Session, generation: u64) -> AppCatalog { +pub(crate) fn build(session: &Session, generation: u64) -> Result { let _ = (session, generation); todo!("sh.A15") } diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 352f6e000..b6e661aa3 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -297,8 +297,8 @@ impl SlideApp { impl crate::SlideApp { /// Runs a fired command, including app save and palette actions. #[allow(dead_code)] // P3(shell-w4): sh.A16 - pub(crate) fn fire(&mut self, fired: &craft::ui::runtime::commands::Fired) { - let _ = fired; + pub(crate) fn fire(&mut self, ctx: &egui::Context, fired: &craft::ui::runtime::commands::Fired) { + let _ = (ctx, fired); todo!("sh.A16") } } diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index ce0140d14..bf4839523 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -4,7 +4,7 @@ use crate::control; impl SlideApp { /// Drain pending control requests, executing ordinary requests and admitting screenshots for /// later saving and reply. - pub(super) fn drain_control(&mut self, ctx: &egui::Context) { + pub(crate) fn drain_control(&mut self, ctx: &egui::Context) { let Some(rx) = self.control_rx.take() else { return }; while let Ok(req) = rx.try_recv() { // A request whose sender gave up waiting (reply timeout) must not run late (#719). diff --git a/crates/ui-egui/src/app/files.rs b/crates/ui-egui/src/app/files.rs index 88cede7fa..0481c3e7b 100644 --- a/crates/ui-egui/src/app/files.rs +++ b/crates/ui-egui/src/app/files.rs @@ -1,6 +1,20 @@ use super::{ - FilePlace, FilePurpose, FileTarget, InboxEvent, LocatedPlace, PendingFile, RECENT_MAX, SlideApp, Target, UiRequest, Value, ViewMode, dialogs, - json, media, + // P3(shell-w6): sh.A8 + FilePlace, + FilePurpose, + FileTarget, + InboxEvent, + LocatedPlace, + PendingFileBase, + RECENT_MAX, + SlideApp, + Target, + UiRequest, + Value, + ViewMode, + dialogs, + json, + media, }; #[derive(Default)] @@ -449,7 +463,8 @@ impl SlideApp { let id = self.begin_external_file(purpose); // Change Picture: the picture that arrives replaces the selected one (#115). if cmd == "picture.change" - && let Some(r) = self.pending_files.iter_mut().find(|r| r.id == id) + // P3(shell-w6): sh.A8 + && let Some(r) = self.pending_files_base.iter_mut().find(|r| r.id == id) { r.purpose = FilePurpose::ChangePicture; } @@ -630,7 +645,8 @@ impl SlideApp { }; for event in events { match event { - InboxEvent::Cancelled { id } => self.pending_files.retain(|r| r.id != id), + // P3(shell-w6): sh.A8 + InboxEvent::Cancelled { id } => self.pending_files_base.retain(|r| r.id != id), InboxEvent::File(file) => self.apply_external_file(file.id, &file.name, &file.bytes), } } @@ -643,7 +659,9 @@ impl SlideApp { pub fn begin_external_file(&mut self, purpose: &str) -> u64 { let id = self.next_file_id; self.next_file_id = self.next_file_id.wrapping_add(1).max(1); - self.pending_files.push(PendingFile { id, purpose: purpose_of(purpose), target: self.capture_file_target() }); + // P3(shell-w6): sh.A8 + // P3(shell-w6): sh.A8 + self.pending_files_base.push(PendingFileBase { id, purpose: purpose_of(purpose), target: self.capture_file_target() }); id } @@ -701,8 +719,10 @@ impl SlideApp { } fn apply_external_file(&mut self, id: u64, name: &str, bytes: &[u8]) { - let Some(pos) = self.pending_files.iter().position(|r| r.id == id) else { return }; - let req = self.pending_files.remove(pos); + // P3(shell-w6): sh.A8 + let Some(pos) = self.pending_files_base.iter().position(|r| r.id == id) else { return }; + // P3(shell-w6): sh.A8 + let req = self.pending_files_base.remove(pos); let cmd = match command_for(req.purpose, name, bytes) { Ok(cmd) => cmd, Err(e) => { @@ -915,3 +935,27 @@ impl crate::SlideApp { todo!("dl.A8") } } + +/// The operation and captured intent completed by a file pick. +#[allow(dead_code)] // P3(shell-w6): sh.A23 +pub(crate) struct FileOperation; + +impl SlideApp { + /// Saves or exports with close intent for the originating Backstage instance. + /// Deferred success closes only that still-open instance for the captured document. + #[allow(dead_code)] // P3(shell-w6): sh.A23 + pub(crate) fn backstage_save_as(&mut self, format: &str, instance: std::sync::Arc<()>) -> SaveOutcome { + let _ = (format, instance); + todo!("sh.A23") + } +} + +impl SlideApp { + /// Saves or exports with close intent for the originating Backstage instance. + /// Deferred success closes only that still-open instance for the captured document. + #[allow(dead_code)] // P3(shell-w6): sh.A23 + pub(crate) fn backstage_export_as(&mut self, format: &str, extra: Value, instance: std::sync::Arc<()>) -> SaveOutcome { + let _ = (format, extra, instance); + todo!("sh.A23") + } +} diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index f71b851b7..34979da0b 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -4,7 +4,8 @@ impl SlideApp { /// What a queued synthetic event is meant for. The control protocol hands out window /// coordinates, so a document, slide, view, zoom or canvas-layout change between queueing and /// the next UI pass makes the event stale. - pub(crate) fn input_target(&self) -> InputTarget { + // P3(shell-w5): sh.A21 + pub(crate) fn input_target_base(&self) -> InputTarget { let bits = |v: f32| if v.is_finite() { v.to_bits() } else { 0 }; InputTarget { documents: self.session.documents().len(), @@ -28,7 +29,8 @@ impl SlideApp { /// Queue one synthetic control-channel event. The target is recorded when the batch starts, /// before any host command in the same logic pass can change the document. pub fn queue_input(&mut self, event: egui::Event) { - let target = self.input_target(); + // P3(shell-w5): sh.A21 + let target = self.input_target_base(); // A batch that was already injected keeps the target it was injected for until its UI // pass consumes it or retracts it. New events queued meanwhile belong to the current // target, so they wait in a separate batch instead of joining the old one and being @@ -139,7 +141,8 @@ impl SlideApp { if !self.synthetic_pending { return; } - let current = self.input_target(); + // P3(shell-w5): sh.A21 + let current = self.input_target_base(); let focus = ctx.memory(|m| m.focused()); if self.synthetic_target == Some(current) && focus == self.synthetic_focus { return; @@ -213,7 +216,8 @@ impl SlideApp { } let focus = ctx.memory(|m| m.focused()); if self.synthetic_pending { - let current = self.input_target(); + // P3(shell-w5): sh.A21 + let current = self.input_target_base(); if self.synthetic_target != Some(current) || focus != self.synthetic_focus { // eframe keeps the whole RawInput from a logic-only pass in `pending_raw_input` // and appends the next host input to it. The events are already in `raw.events`; @@ -234,7 +238,8 @@ impl SlideApp { if self.synthetic_pending || self.synthetic.is_empty() { return; } - let current = self.input_target(); + // P3(shell-w5): sh.A21 + let current = self.input_target_base(); if self.synthetic_target != Some(current) { // The batch was queued for a document/slide/canvas that has since changed. self.synthetic.clear(); @@ -273,7 +278,8 @@ impl SlideApp { impl crate::SlideApp { /// Records injected input for the current target. #[allow(dead_code)] // P3(shell-w5): sh.A21 - pub(crate) fn note_injected(&mut self) { + pub(crate) fn note_injected(&mut self, ctx: &egui::Context) { + let _ = ctx; todo!("sh.A21") } } @@ -286,3 +292,12 @@ impl crate::SlideApp { todo!("sh.A21") } } + +impl SlideApp { + /// Reads the current injected-input target from the current framework context. + #[allow(dead_code)] // P3(shell-w5): sh.A21 + pub(crate) fn input_target(&self, ctx: &egui::Context) -> InputTarget { + let _ = ctx; + todo!("sh.A21") + } +} diff --git a/crates/ui-egui/src/backstage.rs b/crates/ui-egui/src/backstage.rs index d49d281b8..4fd295892 100644 --- a/crates/ui-egui/src/backstage.rs +++ b/crates/ui-egui/src/backstage.rs @@ -38,7 +38,7 @@ const BACK_H: f32 = 46.0; const CONTENT_W: f32 = 1180.0; /// A page of the File tab. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum Page { Home, New, @@ -110,7 +110,7 @@ impl Page { } /// A side-menu entry: a page, or an action that runs at once. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum Nav { Page(Page), Save, @@ -166,11 +166,17 @@ pub enum ExportTask { /// The File tab's state while it is open. #[derive(Clone, Debug)] pub struct Backstage { + /// Identity of this File view, preserved across page changes. + #[allow(dead_code)] // P3(shell-w7): sh.A24 + pub(crate) instance: std::sync::Arc<()>, pub page: Page, /// The open presentations (count, active) when it opened: a change closes it. pub docs: (usize, Option), /// Keyboard focus in the side menu (an index into [`entries`], top then bottom). pub focus: Option, + /// Requests focus on the shown entry for the next File view pass. + #[allow(dead_code)] // P3(shell-w7): sh.A24 + pub(crate) focus_shown: bool, /// Search text on Home, New and Open. pub query: String, /// Info: property drafts while a field is being edited. @@ -199,9 +205,13 @@ impl Backstage { /// can be detected. pub fn new(page: Page, docs: (usize, Option)) -> Backstage { Backstage { + // P3(shell-w7): sh.A24 + instance: Default::default(), page, docs, focus: None, + // P3(shell-w7): sh.A24 + focus_shown: Default::default(), query: String::new(), props: vec![String::new(); PROPERTIES.len()], print_scope: PrintScope::All, diff --git a/crates/ui-egui/src/canvas/previews.rs b/crates/ui-egui/src/canvas/previews.rs index 965088d27..9b02ae098 100644 --- a/crates/ui-egui/src/canvas/previews.rs +++ b/crates/ui-egui/src/canvas/previews.rs @@ -1,6 +1,6 @@ /// Paints animation preview overlays. #[allow(dead_code)] // P3(canvas-w9): cv.A3 -pub(crate) fn paint(draw: &craft::ui::primitives::Draw<'_>, view: &craft::behavior::CanvasView, app: &crate::SlideApp) { - let _ = (draw, view, app); +pub(crate) fn paint(draw: &craft::ui::primitives::Draw<'_>, cx: &craft::ui::canvas::ToolContext<'_>, app: &crate::SlideApp) { + let _ = (draw, cx, app); todo!("cv.A3") } diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 85b22f48c..e177c9e16 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -366,9 +366,10 @@ impl crate::SlideApp { #[allow(dead_code)] // P3(dialogs-w4): dl.A4 pub(crate) struct FormSpec { pub open: fn(&SlideApp, &Context, &Value) -> HostedParamDialog, - pub finish: fn(&mut SlideApp, &ParamResult) -> Result<(), String>, + pub finish: fn(&mut SlideApp, &ParamResult, &mut DialogHost) -> Result<(), String>, pub held: bool, pub each_pass: Option, + pub action: Option Result<(), String>>, } /// The hosted form registry. diff --git a/crates/ui-egui/src/dialogs/action.rs b/crates/ui-egui/src/dialogs/action.rs index 7e3c4dc32..95ede1f46 100644 --- a/crates/ui-egui/src/dialogs/action.rs +++ b/crates/ui-egui/src/dialogs/action.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w12): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w12): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/alt_text.rs b/crates/ui-egui/src/dialogs/alt_text.rs index fb2d78284..b7d3f4f7e 100644 --- a/crates/ui-egui/src/dialogs/alt_text.rs +++ b/crates/ui-egui/src/dialogs/alt_text.rs @@ -35,7 +35,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w12): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w12): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/bullets.rs b/crates/ui-egui/src/dialogs/bullets.rs index a0d6a80d5..0c8bcf644 100644 --- a/crates/ui-egui/src/dialogs/bullets.rs +++ b/crates/ui-egui/src/dialogs/bullets.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w10): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w10): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/chart_data.rs b/crates/ui-egui/src/dialogs/chart_data.rs index 28bbd3dca..1ab60f82d 100644 --- a/crates/ui-egui/src/dialogs/chart_data.rs +++ b/crates/ui-egui/src/dialogs/chart_data.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w14): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w14): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/choice_forms.rs b/crates/ui-egui/src/dialogs/choice_forms.rs index 8006c8d81..7434d8600 100644 --- a/crates/ui-egui/src/dialogs/choice_forms.rs +++ b/crates/ui-egui/src/dialogs/choice_forms.rs @@ -9,7 +9,55 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w7): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w7): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } + +pub(crate) mod setup_show { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod paste_special { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} diff --git a/crates/ui-egui/src/dialogs/closing.rs b/crates/ui-egui/src/dialogs/closing.rs index c1d3d97fd..ef84f1ba4 100644 --- a/crates/ui-egui/src/dialogs/closing.rs +++ b/crates/ui-egui/src/dialogs/closing.rs @@ -23,6 +23,9 @@ pub(crate) struct Closing { guard: craft::quit::CloseGuard, scope: craft::quit::CloseScope, asked: bool, + pending_uid: Option, + completion: Option<(u64, super::super::app::files::SaveOutcome)>, + reason: Option, } impl crate::SlideApp { @@ -41,3 +44,13 @@ impl crate::SlideApp { todo!("dl.A11") } } + +impl Closing { + /// Records a terminal save outcome for the closing pump. + /// Pending outcomes do not settle a close. + #[allow(dead_code)] // P3(dialogs-w5): dl.A11 + pub(crate) fn settle(&mut self, uid: u64, outcome: crate::app::files::SaveOutcome) { + let _ = (uid, outcome); + todo!("dl.A11") + } +} diff --git a/crates/ui-egui/src/dialogs/columns.rs b/crates/ui-egui/src/dialogs/columns.rs index 8c6e625a7..ed2266677 100644 --- a/crates/ui-egui/src/dialogs/columns.rs +++ b/crates/ui-egui/src/dialogs/columns.rs @@ -66,7 +66,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w8): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w8): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/date_time.rs b/crates/ui-egui/src/dialogs/date_time.rs index 02d142d02..e8b12b12c 100644 --- a/crates/ui-egui/src/dialogs/date_time.rs +++ b/crates/ui-egui/src/dialogs/date_time.rs @@ -94,7 +94,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w10): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w10): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/export.rs b/crates/ui-egui/src/dialogs/export.rs index b264e9bb0..4d111923f 100644 --- a/crates/ui-egui/src/dialogs/export.rs +++ b/crates/ui-egui/src/dialogs/export.rs @@ -71,7 +71,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w12): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w12): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/font.rs b/crates/ui-egui/src/dialogs/font.rs index 3f29fca56..9b19096cc 100644 --- a/crates/ui-egui/src/dialogs/font.rs +++ b/crates/ui-egui/src/dialogs/font.rs @@ -174,7 +174,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w11): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w11): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/grid_options.rs b/crates/ui-egui/src/dialogs/grid_options.rs index df55959b7..07c93c55c 100644 --- a/crates/ui-egui/src/dialogs/grid_options.rs +++ b/crates/ui-egui/src/dialogs/grid_options.rs @@ -48,7 +48,13 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w8): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w8): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } + +/// The supported grid spacing in points. +#[allow(dead_code)] // P3(dialogs-w7): dl.A15 +pub(crate) const GRID_SPACING_RANGE: std::ops::RangeInclusive = 1.0..=288.0; diff --git a/crates/ui-egui/src/dialogs/header_footer.rs b/crates/ui-egui/src/dialogs/header_footer.rs index 691b92d98..9f32dffca 100644 --- a/crates/ui-egui/src/dialogs/header_footer.rs +++ b/crates/ui-egui/src/dialogs/header_footer.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w8): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w8): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/insert_forms.rs b/crates/ui-egui/src/dialogs/insert_forms.rs index 8006c8d81..08fd986bd 100644 --- a/crates/ui-egui/src/dialogs/insert_forms.rs +++ b/crates/ui-egui/src/dialogs/insert_forms.rs @@ -9,7 +9,193 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w7): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w7): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } + +pub(crate) mod table { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod comment { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod outline { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod rename_section { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod rename_shape { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod rename_layout { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod equation { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} + +pub(crate) mod smartart { + /// Opens this hosted form with the supplied parameters. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn open( + app: &crate::SlideApp, + ctx: &egui::Context, + params: &serde_json::Value, + ) -> craft::ui::patterns::form_dialogs::HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") + } + /// Applies an accepted form result through the pump dialog host. + #[allow(dead_code)] // P3(dialogs-w7): dl.A9 + pub(crate) fn finish( + app: &mut crate::SlideApp, + result: &craft::ui::patterns::form_dialogs::ParamResult, + host: &mut craft::ui::dialog::DialogHost, + ) -> Result<(), String> { + let _ = (app, result, host); + todo!("dl.A9") + } +} diff --git a/crates/ui-egui/src/dialogs/language.rs b/crates/ui-egui/src/dialogs/language.rs index 1a9e51729..ed6c869c9 100644 --- a/crates/ui-egui/src/dialogs/language.rs +++ b/crates/ui-egui/src/dialogs/language.rs @@ -38,7 +38,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w10): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w10): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/photo_album.rs b/crates/ui-egui/src/dialogs/photo_album.rs index 3f2c8107a..ff9b7eaef 100644 --- a/crates/ui-egui/src/dialogs/photo_album.rs +++ b/crates/ui-egui/src/dialogs/photo_album.rs @@ -350,7 +350,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w13): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w13): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/preferences.rs b/crates/ui-egui/src/dialogs/preferences.rs index 6a5ab3b85..168def633 100644 --- a/crates/ui-egui/src/dialogs/preferences.rs +++ b/crates/ui-egui/src/dialogs/preferences.rs @@ -79,3 +79,15 @@ pub(crate) fn write(app: &mut crate::SlideApp, draft: &PrefDraft) { let _ = (app, draft); todo!("dl.A14") } + +/// Opens nested AutoCorrect while retaining its Preferences parent. +#[allow(dead_code)] // P3(dialogs-w17): dl.A10 +pub(crate) fn open_autocorrect( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/replace_fonts.rs b/crates/ui-egui/src/dialogs/replace_fonts.rs index 4d2f16aed..60e72d656 100644 --- a/crates/ui-egui/src/dialogs/replace_fonts.rs +++ b/crates/ui-egui/src/dialogs/replace_fonts.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w11): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w11): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/reuse_slides.rs b/crates/ui-egui/src/dialogs/reuse_slides.rs index 28bbd3dca..1ab60f82d 100644 --- a/crates/ui-egui/src/dialogs/reuse_slides.rs +++ b/crates/ui-egui/src/dialogs/reuse_slides.rs @@ -9,7 +9,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w14): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w14): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/size_position.rs b/crates/ui-egui/src/dialogs/size_position.rs index 24abd8b9b..9b75e330d 100644 --- a/crates/ui-egui/src/dialogs/size_position.rs +++ b/crates/ui-egui/src/dialogs/size_position.rs @@ -217,7 +217,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w9): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w9): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/slide_size.rs b/crates/ui-egui/src/dialogs/slide_size.rs index 1a738198a..7dd1c2e74 100644 --- a/crates/ui-egui/src/dialogs/slide_size.rs +++ b/crates/ui-egui/src/dialogs/slide_size.rs @@ -39,7 +39,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w8): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w8): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/symbol.rs b/crates/ui-egui/src/dialogs/symbol.rs index a0d6a80d5..06566e897 100644 --- a/crates/ui-egui/src/dialogs/symbol.rs +++ b/crates/ui-egui/src/dialogs/symbol.rs @@ -9,7 +9,16 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w10): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w10): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } + +/// Runs an action delivered by the Symbol form. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn action(app: &mut crate::SlideApp, id: &str) -> Result<(), String> { + let _ = (app, id); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/theme_colors.rs b/crates/ui-egui/src/dialogs/theme_colors.rs index d10e0c13e..d8a550294 100644 --- a/crates/ui-egui/src/dialogs/theme_colors.rs +++ b/crates/ui-egui/src/dialogs/theme_colors.rs @@ -105,7 +105,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w13): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w13): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/theme_fonts.rs b/crates/ui-egui/src/dialogs/theme_fonts.rs index 873ace79d..f8354f025 100644 --- a/crates/ui-egui/src/dialogs/theme_fonts.rs +++ b/crates/ui-egui/src/dialogs/theme_fonts.rs @@ -125,7 +125,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w11): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w11): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/trim.rs b/crates/ui-egui/src/dialogs/trim.rs index bda2a446e..0bd1c4685 100644 --- a/crates/ui-egui/src/dialogs/trim.rs +++ b/crates/ui-egui/src/dialogs/trim.rs @@ -107,7 +107,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w8): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w8): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/dialogs/zoom.rs b/crates/ui-egui/src/dialogs/zoom.rs index b02e7737e..49e81424f 100644 --- a/crates/ui-egui/src/dialogs/zoom.rs +++ b/crates/ui-egui/src/dialogs/zoom.rs @@ -94,7 +94,9 @@ pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_js /// Applies an accepted form result. #[allow(dead_code)] // P3(dialogs-w7): dl.A9 -pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult, host: &mut craft::ui::dialog::DialogHost) -> Result<(), String> { + // P3(dialogs-w7): dl.A9 + let _ = host; let _ = (app, result); todo!("dl.A9") } diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 34e13bf77..b412b0a4c 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -57,7 +57,7 @@ pub mod panels; mod services; mod state; -pub use app::key_name; +pub use app::{AppError, key_name}; #[cfg(test)] use app::{OBJECTS_MARKER, system_clipboard_text, web_image_files}; use canvas::preview; @@ -90,7 +90,8 @@ enum FileTarget { }, } -struct PendingFile { +// P3(shell-w11): sh.A8 +struct PendingFileBase { id: u64, purpose: FilePurpose, target: FileTarget, @@ -251,7 +252,8 @@ pub struct SlideApp { clock: craft::platform::clock::Clock, /// Opening jobs. #[allow(dead_code)] // P3(shell-w11): sh.A8 - opening_jobs: Option>>, + #[cfg(not(target_arch = "wasm32"))] + opening_jobs: opening::OpeningJobs, /// Dialogs. #[allow(dead_code)] // P3(shell-w11): dl.A1 pub(crate) dialogs: dialogs::DialogState, @@ -425,7 +427,10 @@ pub struct SlideApp { /// Next cancellation identity for a browser pick or a dropped file. next_file_id: u64, /// Picks and drops whose bytes have not arrived yet. + #[allow(dead_code)] // P3(shell-w11): sh.A8 pending_files: Vec, + // P3(shell-w11): sh.A8 + pending_files_base: Vec, /// The empty presentation host mode starts with ([`SlideApp::start_for_host`]), until the /// first file the page sends takes its place. host_start: Option, @@ -596,3 +601,11 @@ pub mod thumb_source; #[cfg(test)] pub(crate) mod test_harness; + +/// A file pick with its captured operation and target. +#[allow(dead_code)] // P3(shell-w11): sh.A8 +struct PendingFile { + ticket: craft::host::PickId, + operation: app::FileOperation, + target: FileTarget, +} diff --git a/crates/ui-egui/src/opening.rs b/crates/ui-egui/src/opening.rs index 8905a3933..61afd8f61 100644 --- a/crates/ui-egui/src/opening.rs +++ b/crates/ui-egui/src/opening.rs @@ -317,3 +317,12 @@ mod tests { std::fs::remove_file(&path).ok(); } } + +/// The native open queue and its monotonic attempt-key allocator. +#[cfg(not(target_arch = "wasm32"))] +#[allow(dead_code)] // P3(shell-w3): sh.A8 +#[derive(Default)] +pub(crate) struct OpeningJobs { + queue: Option>>, + next_key: u64, +} diff --git a/crates/ui-egui/src/presenter.rs b/crates/ui-egui/src/presenter.rs index 1ac36d0c4..d310ae8d5 100644 --- a/crates/ui-egui/src/presenter.rs +++ b/crates/ui-egui/src/presenter.rs @@ -41,6 +41,8 @@ impl Preview { } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Snapshot { + /// Document slide aspect used by both shown and pending presenter pictures. + pub aspect: f32, pub slide: usize, pub total: usize, pub ended: bool, @@ -69,7 +71,8 @@ pub struct DeltaCache { token: String, } impl DeltaCache { - pub fn send( + // P3(show-w8): ss.A11 + pub fn send_base( &mut self, mut snapshot: Snapshot, token: &str, @@ -348,6 +351,8 @@ mod tests { fn snapshot() -> Snapshot { Snapshot { + // P3(show-w8): ss.A11 + aspect: Default::default(), slide: 0, total: 2, ended: false, @@ -370,21 +375,24 @@ mod tests { fn failed_transport_retries_images_and_only_success_deduplicates() { let mut cache = DeltaCache::default(); let first = snapshot(); - let failed = cache.send(first.clone(), "session", false, |delta, current, next| { + // P3(show-w8): ss.A11 + let failed = cache.send_base(first.clone(), "session", false, |delta, current, next| { assert!(current && next); assert_eq!(delta.current, first.current); assert_eq!(delta.next, first.next); Err("serialization or postMessage failed") }); assert!(failed.is_err()); - let sent = cache.send(first.clone(), "session", false, |delta, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(first.clone(), "session", false, |delta, current, next| { assert!(current && next, "a failed initial send must not suppress either image"); assert_eq!(delta.current, first.current); assert_eq!(delta.next, first.next); Ok::<_, ()>(()) }); assert!(sent.is_ok()); - let sent = cache.send(first.clone(), "session", false, |delta, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(first.clone(), "session", false, |delta, current, next| { assert!(!current && !next); assert!(delta.current.is_none() && delta.next.is_none()); Ok::<_, ()>(()) @@ -392,12 +400,14 @@ mod tests { assert!(sent.is_ok()); let mut changed = first.clone(); changed.current.as_mut().unwrap().rgba = vec![42; 4]; - let failed = cache.send(changed.clone(), "session", false, |_, current, next| { + // P3(show-w8): ss.A11 + let failed = cache.send_base(changed.clone(), "session", false, |_, current, next| { assert!(current && !next); Err(()) }); assert!(failed.is_err()); - let sent = cache.send(changed.clone(), "session", false, |delta, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(changed.clone(), "session", false, |delta, current, next| { assert!(current && !next, "unchanged retry after a failed changed-image send"); assert_eq!(delta.current, changed.current); Ok::<_, ()>(()) @@ -409,20 +419,23 @@ mod tests { fn transport_refreshes_new_sessions_reloads_and_clears_previews() { let mut cache = DeltaCache::default(); for (token, refresh) in [("first", false), ("second", false), ("second", true)] { - let sent = cache.send(snapshot(), token, refresh, |delta, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(snapshot(), token, refresh, |delta, current, next| { assert!(current && next); assert!(delta.current.is_some() && delta.next.is_some()); Ok::<_, ()>(()) }); assert!(sent.is_ok()); } - let failed = cache.send(snapshot(), "second", true, |_, current, next| { + // P3(show-w8): ss.A11 + let failed = cache.send_base(snapshot(), "second", true, |_, current, next| { assert!(current && next); Err(()) }); // BrowserHost retains refresh_images after failure, even when the token is unchanged. let refresh_images = failed.is_err(); - let sent = cache.send(snapshot(), "second", refresh_images, |_, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(snapshot(), "second", refresh_images, |_, current, next| { assert!(current && next, "reload refresh must survive a failed send"); Ok::<_, ()>(()) }); @@ -430,18 +443,21 @@ mod tests { let mut cleared = snapshot(); cleared.current = None; cleared.next = None; - let failed = cache.send(cleared.clone(), "second", false, |_, current, next| { + // P3(show-w8): ss.A11 + let failed = cache.send_base(cleared.clone(), "second", false, |_, current, next| { assert!(current && next); Err(()) }); assert!(failed.is_err()); - let sent = cache.send(cleared.clone(), "second", false, |delta, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(cleared.clone(), "second", false, |delta, current, next| { assert!(current && next, "clearing images is retried too"); assert!(delta.current.is_none() && delta.next.is_none()); Ok::<_, ()>(()) }); assert!(sent.is_ok()); - let sent = cache.send(cleared, "second", false, |_, current, next| { + // P3(show-w8): ss.A11 + let sent = cache.send_base(cleared, "second", false, |_, current, next| { assert!(!current && !next); Ok::<_, ()>(()) }); @@ -489,6 +505,8 @@ mod tests { fn popup_input_is_forwarded_once_without_advancing_its_own_state() { use egui_kittest::kittest::Queryable; let snapshot = Snapshot { + // P3(show-w8): ss.A11 + aspect: Default::default(), slide: 0, total: 3, ended: false, @@ -599,3 +617,23 @@ pub fn merge(previous: Option<&Snapshot>, delta: SnapshotDelta) -> Snapshot { let _ = (previous, delta); todo!("ss.A11") } + +impl DeltaCache { + /// Sends a delta inside the link envelope without owning transport identity. + /// A failed post leaves the next send requiring a full snapshot. + pub fn send(&mut self, snapshot: Snapshot, refresh: bool, send: impl FnOnce(Snapshot, bool, bool) -> Result<(), E>) -> Result<(), E> { + let _ = (snapshot, refresh, send); + todo!("ss.A11") + } +} +impl SnapshotDelta { + /// Reads the delta envelope with real booleans distinguishing omitted and cleared pictures. + pub fn from_payload(text: &str) -> Option { + let _ = text; + todo!("ss.A11") + } + /// Writes the presenter delta envelope inside the link payload. + pub fn to_payload(&self) -> String { + todo!("ss.A11") + } +} diff --git a/crates/ui-egui/src/presenter_view.rs b/crates/ui-egui/src/presenter_view.rs index e0e98eaeb..a87f451dc 100644 --- a/crates/ui-egui/src/presenter_view.rs +++ b/crates/ui-egui/src/presenter_view.rs @@ -22,6 +22,8 @@ pub enum NextPic<'a> { /// The audience state displayed by the presenter window. pub struct PresenterModel<'a> { + /// Document slide aspect, falling back to 16:9 for invalid values. + pub aspect: f32, /// Slide. pub slide: usize, /// Total. diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index febd5b0d8..a468ae3a8 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -526,3 +526,10 @@ pub(crate) mod fonts; pub(crate) mod states; pub use galleries::preset_outline; + +/// Reads the root ribbon scroll authority, including pending jumps. +#[allow(dead_code)] // P3(ribbon-w4): rb.A1 +pub(crate) fn scroll_position(ctx: &egui::Context) -> craft::behavior::ScrollPos { + let _ = ctx; + todo!("rb.A1") +} diff --git a/crates/ui-egui/src/ribbon/diagram_thumbs.rs b/crates/ui-egui/src/ribbon/diagram_thumbs.rs index f20718393..a8189ebd0 100644 --- a/crates/ui-egui/src/ribbon/diagram_thumbs.rs +++ b/crates/ui-egui/src/ribbon/diagram_thumbs.rs @@ -30,3 +30,12 @@ pub(crate) fn thumbnails(ctx: &egui::Context) -> Thumbnails { let _ = ctx; todo!("rb.A17") } + +impl DiagramThumbs<'_> { + /// Keys the layout by its style, colours, outline and every drawn node field. + #[allow(dead_code)] // P3(ribbon-w5): rb.A17 + pub(crate) fn key(&self, kind: &str, outline: bool) -> u64 { + let _ = (kind, outline); + todo!("rb.A17") + } +} diff --git a/crates/ui-egui/src/ribbon/galleries.rs b/crates/ui-egui/src/ribbon/galleries.rs index 23e66b48d..864fc66c4 100644 --- a/crates/ui-egui/src/ribbon/galleries.rs +++ b/crates/ui-egui/src/ribbon/galleries.rs @@ -401,8 +401,8 @@ fn paint_freeform_icon(p: &egui::Painter, r: Rect, name: &str, ink: Color32) { /// Shows the line style menu. #[allow(dead_code)] // P3(ribbon-w5): rb.A16 -pub(crate) fn line_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { - let _ = (app, ui, cx); +pub(crate) fn line_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>, key: &str) { + let _ = (app, ui, cx, key); todo!("rb.A16") } @@ -421,7 +421,14 @@ pub fn preset_outline(r: Rect, name: &str) -> Vec> { /// Shows the outline menu; a pick runs its command and closes the menu. #[allow(dead_code)] // P3(ribbon-w5): rb.A16 -pub fn outline_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { - let _ = (app, ui, cx); +pub fn outline_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>, key: &str) { + let _ = (app, ui, cx, key); + todo!("rb.A16") +} + +/// Applies a delayed outline colour answer using the opener key and shared line-pick path. +#[allow(dead_code)] // P3(ribbon-w5): rb.A16 +pub(crate) fn apply_line_answer(app: &mut SlideApp, key: &str) { + let _ = (app, key); todo!("rb.A16") } diff --git a/crates/ui-egui/src/settings.rs b/crates/ui-egui/src/settings.rs index f5c4d64db..8c51f86de 100644 --- a/crates/ui-egui/src/settings.rs +++ b/crates/ui-egui/src/settings.rs @@ -173,7 +173,8 @@ mod tests { /// Imports the old ui.json and prefs.json settings once. #[allow(dead_code)] // P3(shell-w12): sh.A25 -pub(crate) fn legacy() -> Vec> { +pub(crate) fn legacy(dir: &std::path::Path) -> Vec> { + let _ = dir; todo!("sh.A25") } diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 351d8b893..d90b01d39 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -46,9 +46,9 @@ pub struct Show { #[allow(dead_code)] // P3(show-w4): ss.A4 frames: frames::ShowFrames, #[allow(dead_code)] // P3(show-w4): ss.A4 - next_preview: Option<(std::sync::Arc, usize, std::sync::Arc)>, + next_preview: Option<(std::sync::Arc, usize)>, #[allow(dead_code)] // P3(show-w4): ss.A4 - presenter_start: PresenterStart, + pub(crate) presenter_start: PresenterStart, #[allow(dead_code)] // P3(show-w4): ss.A4 remote_images: crate::presenter::DeltaCache, @@ -679,7 +679,7 @@ pub enum Blank { impl Show { /// The current zoom window in slide space. #[allow(dead_code)] // P3(show-w4): ss.A5 - pub(crate) fn zoom_window(&self) -> Option { + pub(crate) fn zoom_window(&self) -> Option { todo!("ss.A5") } } @@ -687,8 +687,8 @@ impl Show { impl Show { /// Zooms the audience at a slide point. #[allow(dead_code)] // P3(show-w4): ss.A5 - pub(crate) fn zoom_at(&mut self, at: craft::behavior::kurbo::Point) { - let _ = at; + pub(crate) fn zoom_at(&mut self, at: craft::behavior::kurbo::Point, inputs: &ShowZoomInputs<'_>) { + let _ = (at, inputs); todo!("ss.A5") } } @@ -696,8 +696,8 @@ impl Show { impl Show { /// The next show wake deadline. #[allow(dead_code)] // P3(show-w4): ss.A5 - pub(crate) fn next_wake(&self, now: f64) -> Option { - let _ = now; + pub(crate) fn next_wake(&self, doc: &Presentation, now: f64) -> Option { + let _ = (doc, now); todo!("ss.A5") } } @@ -727,3 +727,14 @@ pub(crate) mod commands; pub(crate) mod frames; pub(crate) mod grid; pub(crate) mod tool; + +/// The show command scope shared with the browser presenter shell. +pub const SHOW_SCOPE: craft::ui::runtime::commands::CommandScope = ::SCOPE; + +/// Current canvas inputs used by show zoom operations. +#[allow(dead_code)] // P3(show-w4): ss.A5 +pub(crate) struct ShowZoomInputs<'a> { + pub size: craft::behavior::kurbo::Size, + pub pixels_per_point: f32, + pub scheme: &'a craft::behavior::ZoomScheme, +} diff --git a/crates/ui-egui/src/show/bars.rs b/crates/ui-egui/src/show/bars.rs index 59a4d4b1c..6eda99442 100644 --- a/crates/ui-egui/src/show/bars.rs +++ b/crates/ui-egui/src/show/bars.rs @@ -1,6 +1,6 @@ /// Shows the audience show bars. #[allow(dead_code)] // P3(show-w5): ss.A9 -pub(crate) fn show(ui: &mut egui::Ui, show: &super::Show, room: egui::Rect) { - let _ = (ui, show, room); +pub(crate) fn show(ui: &mut egui::Ui, show: &super::Show, doc: &deckcraft_model::Presentation, room: egui::Rect) { + let _ = (ui, show, doc, room); todo!("ss.A9") } diff --git a/crates/ui-egui/src/show/commands.rs b/crates/ui-egui/src/show/commands.rs index 3df4634a0..cb3fbfba9 100644 --- a/crates/ui-egui/src/show/commands.rs +++ b/crates/ui-egui/src/show/commands.rs @@ -82,8 +82,9 @@ pub(crate) fn run_command( now: f64, command: ShowCommands, window: ShowWindow, + zoom: &super::ShowZoomInputs<'_>, ) -> bool { - let _ = (show, doc, now, command, window); + let _ = (show, doc, now, command, window, zoom); todo!("ss.A2") } diff --git a/crates/ui-egui/src/show/frames.rs b/crates/ui-egui/src/show/frames.rs index 894b33153..ee098a31f 100644 --- a/crates/ui-egui/src/show/frames.rs +++ b/crates/ui-egui/src/show/frames.rs @@ -17,14 +17,23 @@ pub(crate) struct PreviewFrame { /// The show frame jobs and cached pictures. #[allow(dead_code)] // P3(show-w6): ss.A7 +#[derive(Default)] pub(crate) struct ShowFrames { - pub(crate) previews: craft::host::queue::JobQueue, + previews: Option>, } /// Prepares show frames and preview jobs. #[allow(dead_code)] // P3(show-w6): ss.A7 -pub(crate) fn prepare(show: &mut super::Show, doc: &Arc, media: &crate::media::MediaHost, room_px: egui::Vec2) { - let _ = (show, doc, media, room_px); +pub(crate) fn prepare( + show: &mut super::Show, + doc: &Arc, + media: &crate::media::MediaHost, + ctx: &egui::Context, + now: f64, + gifs: &[crate::media::Gif], + room_px: egui::Vec2, +) -> Option { + let _ = (show, doc, media, ctx, now, gifs, room_px); todo!("ss.A7") } @@ -44,8 +53,8 @@ pub(crate) fn paint( impl ShowFrames { /// Returns a show backdrop. #[allow(dead_code)] // P3(show-w6): ss.A7 - pub(crate) fn backdrop(&mut self, doc: &Arc, key: super::BackKey) -> Arc { - let _ = (doc, key); + pub(crate) fn backdrop(&mut self, ctx: &egui::Context, doc: &Arc, key: super::BackKey) -> Arc { + let _ = (ctx, doc, key); todo!("ss.A7") } } @@ -53,8 +62,8 @@ impl ShowFrames { impl ShowFrames { /// Prefetches a show backdrop. #[allow(dead_code)] // P3(show-w6): ss.A7 - pub(crate) fn prefetch_backdrop(&mut self, doc: &Arc, key: super::BackKey) { - let _ = (doc, key); + pub(crate) fn prefetch_backdrop(&mut self, ctx: &egui::Context, doc: &Arc, key: super::BackKey) { + let _ = (ctx, doc, key); todo!("ss.A7") } } @@ -83,8 +92,43 @@ impl ShowFrames { } } -impl Default for ShowFrames { +impl ShowFrames { + // P3(show-w6): ss.A7 + #[allow(dead_code)] // P3(show-w6): ss.A7 + fn default_base() -> Self { + todo!("ss.A7") + } +} + +/// Queue options for production show frames, backdrops and next previews. +#[allow(dead_code)] // P3(show-w6): ss.A7 +pub(crate) struct ShowFrameOptions { + pub next: craft::host::queue::QueueOptions, + pub backdrops: craft::host::queue::QueueOptions, + pub previews: craft::host::queue::QueueOptions, +} +impl Default for ShowFrameOptions { fn default() -> Self { todo!("ss.A7") } } +impl ShowFrames { + /// Initializes production queues once and keeps jobs on repeated calls. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn initialize(&mut self, ctx: &egui::Context, host: &craft::host::Host, options: ShowFrameOptions) { + let _ = (ctx, host, options); + todo!("ss.A7") + } + /// Requests a coalesced next preview, or withdraws it when no slide is wanted. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn request_preview(&mut self, ctx: &egui::Context, doc: Arc, slide: Option) { + let _ = (ctx, doc, slide); + todo!("ss.A7") + } + /// Runs one bounded inline budget across all show queues. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn run_inline(&mut self, max_jobs: usize) { + let _ = max_jobs; + todo!("ss.A7") + } +} diff --git a/crates/ui-egui/src/show/grid.rs b/crates/ui-egui/src/show/grid.rs index 0985c7fca..0cf1b0afc 100644 --- a/crates/ui-egui/src/show/grid.rs +++ b/crates/ui-egui/src/show/grid.rs @@ -5,7 +5,7 @@ pub enum GridSource<'a> { /// Presentation. doc: &'a deckcraft_model::Presentation, /// Thumbnail store. - thumbs: &'a craft::ui::primitives::Thumbnails, + thumbs: &'a craft::ui::primitives::Thumbnails, /// Presentation thumbnail source. source: &'a crate::thumb_source::DeckThumbs, }, diff --git a/crates/ui-egui/src/show/keys.rs b/crates/ui-egui/src/show/keys.rs index 83e309b26..cb5be19a6 100644 --- a/crates/ui-egui/src/show/keys.rs +++ b/crates/ui-egui/src/show/keys.rs @@ -86,7 +86,8 @@ fn navigation_key( match k { Escape | Minus => { let cancelled = k == Escape && show.clear_goto(); - if !cancelled && !show.back_out(presenter) { + // P3(show-w4): ss.A5 + if !cancelled && !show.back_out_base(presenter) { *keep = false; } } diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index c2709455a..8d9d9c6a3 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -872,14 +872,18 @@ fn escape_only_closes_the_grid_of_its_own_window() { let doc = s.active().unwrap().doc.clone(); let mut show = Show::new(&doc, 0, false, true); show.presenter_grid = true; - assert!(!show.back_out(false), "audience Esc leaves the show, the Presenter View grid stays"); + // P3(show-w10): ss.A5 + assert!(!show.back_out_base(false), "audience Esc leaves the show, the Presenter View grid stays"); assert!(show.presenter_grid); - assert!(show.back_out(true)); + // P3(show-w10): ss.A5 + assert!(show.back_out_base(true)); assert!(!show.presenter_grid); show.grid = true; - assert!(!show.back_out(true), "Presenter View Esc does not close the audience grid"); + // P3(show-w10): ss.A5 + assert!(!show.back_out_base(true), "Presenter View Esc does not close the audience grid"); assert!(show.grid); - assert!(show.back_out(false)); + // P3(show-w10): ss.A5 + assert!(show.back_out_base(false)); assert!(!show.grid); } @@ -891,12 +895,15 @@ fn escape_leaves_the_grid_then_the_zoom_and_blank_toggles() { let mut show = Show::new(&doc, 0, false, true); show.grid = true; show.zoom = Some(Zoom::at(0.2, 0.3)); - assert!(show.back_out(false)); + // P3(show-w10): ss.A5 + assert!(show.back_out_base(false)); assert!(!show.grid); assert!(show.zoom.is_some(), "closing the grid leaves the zoom"); - assert!(show.back_out(false)); + // P3(show-w10): ss.A5 + assert!(show.back_out_base(false)); assert!(show.zoom.is_none()); - assert!(!show.back_out(false)); + // P3(show-w10): ss.A5 + assert!(!show.back_out_base(false)); show.zoom_key(); assert!(show.zoom_arm); show.zoom_key(); diff --git a/crates/ui-egui/src/show/ui.rs b/crates/ui-egui/src/show/ui.rs index cb96477e1..7cee92faf 100644 --- a/crates/ui-egui/src/show/ui.rs +++ b/crates/ui-egui/src/show/ui.rs @@ -178,6 +178,8 @@ pub(crate) fn ui(app: &mut SlideApp, ui: &mut Ui, bcx: &mut craft::ui::contract: } } host.update(crate::presenter::Snapshot { + // P3(show-w5): ss.A11 + aspect: Default::default(), slide: show.state.slide, total: doc.slides.len(), ended: show.ended, @@ -285,7 +287,8 @@ fn handle_clicks(app: &mut SlideApp, ui: &mut Ui, show: &mut Show, f: &Fr, out: show.zoom_arm = false; } } else if clicked && show.zoom.is_some() && !show.pen && !show.reading_bar_hit(ctx) { - show.dismiss_zoom(); + // P3(show-w5): ss.A5 + show.dismiss_zoom_base(); } else if clicked && !show.pen && !show.reading_bar_hit(ctx) && !pointer_on_media_bar(ctx, ui, doc, show, now) { if show.ended { out.keep = false; diff --git a/crates/ui-egui/src/show/zoom.rs b/crates/ui-egui/src/show/zoom.rs index 22c18673c..dc6c09c77 100644 --- a/crates/ui-egui/src/show/zoom.rs +++ b/crates/ui-egui/src/show/zoom.rs @@ -29,7 +29,8 @@ impl Show { /// Z, or the Zoom button: arm a click-to-zoom, or leave a zoom that is already on. pub(super) fn zoom_key(&mut self) { if self.zoom.is_some() || self.zoom_arm { - self.dismiss_zoom(); + // P3(show-w4): ss.A5 + self.dismiss_zoom_base(); } else { self.zoom_arm = true; self.pen = false; @@ -61,7 +62,8 @@ impl Show { } /// Esc closes the See All Slides of the window it was pressed in, then a zoom, and only then leaves the show. - pub(super) fn back_out(&mut self, presenter: bool) -> bool { + // P3(show-w4): ss.A5 + pub(super) fn back_out_base(&mut self, presenter: bool) -> bool { if presenter && self.presenter_grid { self.presenter_grid = false; true @@ -69,12 +71,14 @@ impl Show { self.grid = false; true } else { - self.dismiss_zoom() + // P3(show-w4): ss.A5 + self.dismiss_zoom_base() } } /// Esc backs out of a zoom before it leaves the show. True when it did. - pub(super) fn dismiss_zoom(&mut self) -> bool { + // P3(show-w4): ss.A5 + pub(super) fn dismiss_zoom_base(&mut self) -> bool { if self.zoom.is_some() || self.zoom_arm { self.zoom = None; self.zoom_arm = false; @@ -403,3 +407,18 @@ pub(super) fn paint_grid(painter: &egui::Painter, ctx: &egui::Context, show: &mu ); } } + +impl Show { + /// Dismisses the zoom with the current pass inputs. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn dismiss_zoom(&mut self, inputs: &super::ShowZoomInputs<'_>) { + let _ = inputs; + todo!("ss.A5") + } + /// Closes the target window grid, then dismisses zoom before leaving the show. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn back_out(&mut self, presenter: bool, inputs: &super::ShowZoomInputs<'_>) -> bool { + let _ = (presenter, inputs); + todo!("ss.A5") + } +} diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index d7361d169..e6b5f1c42 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -2134,58 +2134,78 @@ fn synthetic_click_is_consumed_on_its_old_target_before_logic_changes_the_docume fn input_target_tracks_slideshow_opening_and_palette_selection() { // P3(shell-w10): sh.A2 let mut app = SlideApp::new_base(Session::with_new(), Services::default()); - let base = app.input_target(); + // P3(shell-w10): sh.A21 + let base = app.input_target_base(); app.start_show(0, true); - assert_ne!(app.input_target(), base, "a slideshow is a different input target"); - let started = app.input_target(); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), base, "a slideshow is a different input target"); + // P3(shell-w10): sh.A21 + let started = app.input_target_base(); app.show.as_mut().unwrap().state.step += 1; - let stepped = app.input_target(); + // P3(shell-w10): sh.A21 + let stepped = app.input_target_base(); assert_ne!(stepped, started, "the show step changes which click areas are live"); let reading_now = app.show.as_ref().unwrap().reading; app.show.as_mut().unwrap().reading = !reading_now; - let reading = app.input_target(); + // P3(shell-w10): sh.A21 + let reading = app.input_target_base(); assert_ne!(reading, stepped, "the reading layout moves the slide"); app.show.as_mut().unwrap().grid = true; - let grid = app.input_target(); + // P3(shell-w10): sh.A21 + let grid = app.input_target_base(); assert_ne!(grid, reading, "See All Slides turns a click into a thumbnail choice"); app.show.as_mut().unwrap().ended = true; - let ended = app.input_target(); + // P3(shell-w10): sh.A21 + let ended = app.input_target_base(); assert_ne!(ended, grid, "the end screen has different click targets"); app.show = None; - assert_eq!(app.input_target(), base, "leaving the show returns to the editor target"); + // P3(shell-w10): sh.A21 + assert_eq!(app.input_target_base(), base, "leaving the show returns to the editor target"); // Starting the show again is a new instance even at the same slide, so an old batch cannot // match by value after an ABA transition. app.start_show(0, true); - let first_instance = app.input_target(); + // P3(shell-w10): sh.A21 + let first_instance = app.input_target_base(); app.start_show(0, true); - assert_ne!(app.input_target(), first_instance, "a new show instance is a new target"); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), first_instance, "a new show instance is a new target"); app.show = None; app.opening = Some(crate::opening::Opening::for_test("/tmp/quarterly.pptx")); - assert_ne!(app.input_target(), base, "the background-open window is a different target"); - let opening = app.input_target(); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), base, "the background-open window is a different target"); + // P3(shell-w10): sh.A21 + let opening = app.input_target_base(); app.opening.as_mut().unwrap().generation = 2; - assert_ne!(app.input_target(), opening, "reopening the same path is a new attempt"); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), opening, "reopening the same path is a new attempt"); app.opening = None; app.palette = Some(("open".into(), 0)); - let first = app.input_target(); + // P3(shell-w10): sh.A21 + let first = app.input_target_base(); app.palette = Some(("open".into(), 1)); - assert_ne!(app.input_target(), first, "the palette's highlighted entry is part of the target"); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), first, "the palette's highlighted entry is part of the target"); app.palette = None; app.ui.tab = "Insert".into(); - assert_ne!(app.input_target(), base, "another ribbon tab is another click target"); - let insert = app.input_target(); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), base, "another ribbon tab is another click target"); + // P3(shell-w10): sh.A21 + let insert = app.input_target_base(); app.ui.ribbon_collapsed = true; - assert_ne!(app.input_target(), insert, "collapsing the ribbon changes the layout under a click"); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), insert, "collapsing the ribbon changes the layout under a click"); app.ui.ribbon_collapsed = false; app.ribbon_scroll.insert("Insert".into(), 64.0_f32.to_bits()); - assert_ne!(app.input_target(), insert, "scrolling the ribbon moves the buttons under a click"); + // P3(shell-w10): sh.A21 + assert_ne!(app.input_target_base(), insert, "scrolling the ribbon moves the buttons under a click"); app.ui.tab = "Home".into(); app.ribbon_scroll.remove("Insert"); - assert_eq!(app.input_target(), base); + // P3(shell-w10): sh.A21 + assert_eq!(app.input_target_base(), base); } /// A click queued for the editor is retracted when a slideshow, background-open window or diff --git a/crates/ui-egui/src/thumb_source.rs b/crates/ui-egui/src/thumb_source.rs index 511b8c056..170bd5db6 100644 --- a/crates/ui-egui/src/thumb_source.rs +++ b/crates/ui-egui/src/thumb_source.rs @@ -7,10 +7,17 @@ use std::sync::Arc; /// A slide or master layout thumbnail key. #[allow(dead_code)] // P3(panels-w4): pn.A1 -#[derive(Clone, Copy)] -pub(crate) enum ThumbKey { +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum ThumbKey { + /// A presentation slide. Slide(SlideId), - Layout { master: usize, layout: Option }, + /// A master or one of its layouts. + Layout { + /// The master index. + master: usize, + /// The layout index, or the master itself. + layout: Option, + }, } impl ThumbKey { @@ -40,12 +47,12 @@ impl DeckThumbs { } } -impl ThumbSource for DeckThumbs { - fn revision(&self, key: &u64, request: &ThumbRequest) -> Revision { +impl ThumbSource for DeckThumbs { + fn revision(&self, key: &ThumbKey, request: &ThumbRequest) -> Revision { let _ = (key, request); todo!("pn.A1") } - fn render(&self, key: &u64, request: &ThumbRequest) -> ThumbRender { + fn render(&self, key: &ThumbKey, request: &ThumbRequest) -> ThumbRender { let _ = (key, request); todo!("pn.A1") } @@ -53,21 +60,21 @@ impl ThumbSource for DeckThumbs { /// Returns the shared deck thumbnail store. #[allow(dead_code)] // P3(panels-w4): pn.A1 -pub(crate) fn thumbnails(ctx: &egui::Context) -> Thumbnails { +pub(crate) fn thumbnails(ctx: &egui::Context) -> Thumbnails { let _ = ctx; todo!("pn.A1") } /// Shows a deck thumbnail picture. #[allow(dead_code)] // P3(panels-w4): pn.A1 -pub(crate) fn picture<'a>(label: impl Into