mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-02 10:38:15 -06:00
Merge look-fix2 app work (slot 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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| {
|
||||
|
||||
@@ -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<String> = 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:?}");
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -115,7 +115,8 @@ impl PaneContent<Pane> 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));
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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<craft::theme::AppSizes> {
|
||||
static SIZES: std::sync::LazyLock<std::sync::Arc<craft::theme::AppSizes>> =
|
||||
|
||||
Reference in New Issue
Block a user