diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 3f46ca3bd..ccd226cc2 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -522,9 +522,7 @@ impl SlideApp { self.set_status("The file path is not valid Unicode; rename the file and open it again."); } } - for (_, error) in self.open_from_system(&names) { - self.set_status(error); - } + self.open_from_system(&names); } Intake::Dropped { files, .. } => { for file in files { diff --git a/crates/ui-egui/src/app/files.rs b/crates/ui-egui/src/app/files.rs index d2d36af83..c39560afa 100644 --- a/crates/ui-egui/src/app/files.rs +++ b/crates/ui-egui/src/app/files.rs @@ -327,14 +327,17 @@ impl SlideApp { /// association), opened in order. When the last one is a PowerPoint Show (`.ppsx`, or the /// 97-2003 `.pps`), its slide show starts at once from where Play from Start begins, as /// PowerPoint does; anything else opens for editing, and File › Open opens a `.ppsx` for - /// editing too. Returns the files that couldn't be opened, with the reason. + /// editing too. Each file that couldn't be opened posts its reason to the status line; they are returned with it. pub fn open_from_system(&mut self, paths: &[String]) -> Vec<(String, String)> { let mut failed = Vec::new(); let mut last = None; for p in paths { match self.open_path(p) { Ok(()) => last = Some(p), - Err(e) => failed.push((p.clone(), e)), + Err(e) => { + self.set_status(e.clone()); + failed.push((p.clone(), e)); + } } } if last.is_some_and(|p| { diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 1034c8ff2..aa59a3545 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -580,3 +580,25 @@ fn canvas_menu_rows_follow_the_selection() { } } } + +/// The panes of a deck with no slides each show their egui panel once per pass: egui drew "First/Second use of Panel ID" +/// over the canvas and the notes pane. +#[test] +fn a_deck_with_no_slides_shows_each_pane_once() { + let mut h = harness(); + h.ctx.options_mut(|options| options.warn_on_id_clash = true); + h.state_mut().ui.notes = true; + h.state_mut().run("slide.delete", json!({})).unwrap(); + assert!(h.state().session.active().unwrap().doc.slides.is_empty()); + h.run_steps(4); + let clashes: Vec = h + .output() + .shapes + .iter() + .filter_map(|clipped| match &clipped.shape { + egui::Shape::Text(text) if text.galley.job.text.contains(" use of ") => Some(text.galley.job.text.clone()), + _ => None, + }) + .collect(); + assert!(clashes.is_empty(), "egui reported id clashes: {clashes:?}"); +} diff --git a/crates/ui-egui/src/opening.rs b/crates/ui-egui/src/opening.rs index 314d9fb8b..1b5861277 100644 --- a/crates/ui-egui/src/opening.rs +++ b/crates/ui-egui/src/opening.rs @@ -296,6 +296,15 @@ mod tests { assert!(h.state().show.is_none(), "the last file is a .pptx"); } + /// A file the system hands over that cannot be opened says why on the status line, whichever way it arrived. + #[test] + fn a_failed_open_from_the_system_posts_its_error() { + let mut h = scripted(Session::new(), Arc::new(ScriptedFiles::new())); + let failed = h.state_mut().open_from_system(&["/nonexistent/missing.pptx".to_owned()]); + assert_eq!(failed.len(), 1); + assert_eq!(h.state().fresh_status(), Some(failed[0].1.as_str())); + } + /// #862: File › Open opens a `.ppsx` for editing, as PowerPoint does. #[test] fn file_open_opens_a_ppsx_for_editing() { diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index f9e6b3fea..5577ebf3a 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -115,7 +115,8 @@ impl PaneContent for Content<'_, '_> { let (edge, size, min, max) = match pane { Pane::Thumbs => (PaneEdge::Start, 236.0, 150.0, 420.0), Pane::Outline => (PaneEdge::Start, 360.0, 240.0, 520.0), - Pane::Notes => (PaneEdge::Bottom, 160.0, 36.0, 400.0), + // Two lines of notes: the notes pane opens at its least height, as 0.19's did. + Pane::Notes => (PaneEdge::Bottom, 160.0, 78.0, 400.0), Pane::Task(_) => (PaneEdge::End, 300.0, 240.0, 520.0), }; let mut spec = PaneSpec::new(self.title(pane), PaneState::docked(edge, size), vec2(size, size)); diff --git a/crates/ui-egui/src/sizes.json b/crates/ui-egui/src/sizes.json index ce84c9d4e..ccf7bbba2 100644 --- a/crates/ui-egui/src/sizes.json +++ b/crates/ui-egui/src/sizes.json @@ -1,6 +1,8 @@ { "all": { "radius.surface": 8, + "size.bar.status": 28, + "size.bar.title": 38, "size.icon.glyph_md": 16, "size.page.column": 1180, "space.inset.fit": 28, diff --git a/crates/ui-egui/src/status.rs b/crates/ui-egui/src/status.rs index 7b7b6a2d8..5f9fa4093 100644 --- a/crates/ui-egui/src/status.rs +++ b/crates/ui-egui/src/status.rs @@ -1,6 +1,7 @@ //! Slide position, proofing language, view commands and zoom in the shared status bar. use craft::behavior::{ZoomScheme, kurbo::Size}; +use craft::theme::variant::Tone; use craft::ui::bars::{Bar, BarKind, StatusMessage}; use craft::ui::buttons::{IconButton, Link, LinkLook, ToggleButton}; use craft::ui::choice::Segmented; @@ -78,7 +79,7 @@ pub fn status_bar(app: &mut SlideApp, ui: &mut Ui) { ); open_language |= link.clicked(); if let Some(message) = &message { - StatusMessage::new(message.clone()).show(ui); + StatusMessage::new(message.clone()).tone(Tone::Accent).show(ui); ui.ctx().request_repaint_after(std::time::Duration::from_millis(500)); } }); diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 271e1672c..956fc4634 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -265,7 +265,7 @@ pub fn to_color32(c: deckcraft_color::Rgba) -> Color32 { Color32::from_rgba_unmultiplied(c.r, c.g, c.b, c.a) } -/// DeckCraft's overrides of the suite's size sets (`sizes.json`): its interface type scale, surface rounding, File page column and the slide's fit margin (0.19's 28 points). One +/// DeckCraft's overrides of the suite's size sets (`sizes.json`): its interface type scale, title and status bar heights, surface rounding, File page column and the slide's fit margin (0.19's 28 points). One /// shared value, so every root that carries it keeps one identity for the token cache. pub fn app_sizes() -> std::sync::Arc { static SIZES: std::sync::LazyLock> =