DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
L: alternate layouts keep their stories linked to the originals
Brandon Thomasd30285c542f2
diff --git a/ROADMAP.md b/ROADMAP.mdindex 60169ff49..b4b5528b6 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -92,7 +92,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope- Power Zoom (Hand tool: press and hold still for half a second, or Alt-press): zoom out to the spread, aim the red view rectangle, release to zoom back in there.- Graphic cells (`table.placeGraphic`, `table.textCell`, Table › Convert Cell Type, Table panel): images in table cells, fitted or filled, clipped to the cell on screen and in PDF.- Live Distribute (Space while dragging a selection handle; `transform.resize {distribute}`): objects keep their size and spread with the bounds.-- Liquid Layout (`liquid.pageRule/object`, `guide.liquid`, `layout.createAlternate`, Liquid Layout panel): scale / re-center / guide-based / object-based page rules applied on page resize and Document Setup; dashed liquid guides; alternate layouts as resized page copies in a named section. Alternate layouts aren't linked to their source.+- Liquid Layout (`liquid.pageRule/object`, `guide.liquid`, `layout.createAlternate`, Liquid Layout panel): scale / re-center / guide-based / object-based page rules applied on page resize and Document Setup; dashed liquid guides; alternate layouts as resized page copies in a named section. Text in an alternate layout stays linked to the original stories (Links panel shows them out of date; `story.updateLink`).- Split Window / New Window (`window.split`, `window.newWindow`, Window ▸ Arrange): two side-by-side views of the document with their own zoom, scroll and render cache. New Window puts the second view in its own OS window (an egui viewport; a floating window on the web).- Transparency flattener (`file.exportPdf {flatten: high|medium|low|ppi}`, Edit ▸ Transparency Flattener Presets): each object involving transparency becomes an opaque image of its area over what's beneath it, so everything else stays vector (spreads with transparent parent items are rasterised whole).- Video and sound (place .mp4/.mov/.webm/.mp3/.wav…, `media.options/get`, Media panel): media frames show a poster or placeholder on screen, in print and in PDF, and export as HTML5 `<video>`/`<audio>` in EPUB. No in-app playback or PDF rich media.diff --git a/crates/engine/src/cmd/liquid.rs b/crates/engine/src/cmd/liquid.rsindex 5cf5c2a8b..604369df6 100644--- a/crates/engine/src/cmd/liquid.rs+++ b/crates/engine/src/cmd/liquid.rs@@ -230,7 +230,19 @@ fn create_alternate(s: &mut crate::Session, p: &Value) -> Result<Value> {g}).collect();- super::object::duplicate_from(d, &src, &ids, SpreadRef::Doc(ti), designcraft_geom::Vec2::new(to.x0 - pb.x0, 0.0))?;+ let new = super::object::duplicate_from(d, &src, &ids, SpreadRef::Doc(ti), designcraft_geom::Vec2::new(to.x0 - pb.x0, 0.0))?;+ // The copies' stories stay linked to the originals (Links panel: update when they change).+ for (old, new) in ids.iter().zip(&new) {+ let (Some(os), Some(ns)) =+ (src.item(*old).and_then(|i| i.text_frame()).map(|t| t.story), d.item(*new).and_then(|i| i.text_frame()).map(|t| t.story))+ else {+ continue;+ };+ let rev = src.story(os).map_or(0, |s| s.rev);+ if let Some(st) = d.story_mut(ns) {+ st.link = Some((os, rev));+ }+ }}let pages: Vec<usize> = (n + 1..=2 * n).collect();super::layout::resize_pages(d, &pages, Some(w), Some(h));@@ -307,5 +319,11 @@ mod tests {assert!((bounds(&s, a).width() - 200.0).abs() < 1e-6 && (bounds(&s, b).width() - 100.0).abs() < 1e-6);s.execute("edit.undo", &json!({})).unwrap();assert_eq!(s.doc().unwrap().doc.page_count(), 1);+ // Text in an alternate layout stays linked to the original story.+ s.execute("edit.redo", &json!({})).unwrap();+ let t = s.execute("frame.create", &json!({"rect": [100, 300, 300, 400], "content": "text", "text": "Original", "caret": false})).unwrap();+ s.execute("layout.createAlternate", &json!({"name": "Tall", "width": 600, "height": 1200})).unwrap();+ let links = s.execute("story.links", &json!({})).unwrap();+ assert!(links.as_array().unwrap().iter().any(|l| l["parent"] == t["story"]), "{links}");}}diff --git a/docs/parity.md b/docs/parity.mdindex b7308f641..462764cfe 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -11,7 +11,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia|---|---|---|---|---|---|| P0 | 102 | 100 | 2 | 0 | 99% || P1 | 97 | 96 | 1 | 0 | 99% |-| P2 | 76 | 65 | 11 | 0 | 93% |+| P2 | 76 | 66 | 10 | 0 | 93% || Area | Parity ||---|---|@@ -79,7 +79,7 @@ Open P0 items: Vector/page formats (PDF/AI/SVG/EPS place), Export to PDF (print)| Documents, pages, spreads | Layout Adjustment | P2 | D || Documents, pages, spreads | Adjust Layout | P2 | D || Documents, pages, spreads | Liquid layout | P2 | D |-| Documents, pages, spreads | Alternate layouts | P2 | P |+| Documents, pages, spreads | Alternate layouts | P2 | D || Documents, pages, spreads | Document grid & baseline grid | P0 | D || Documents, pages, spreads | Ruler guides | P0 | D || Documents, pages, spreads | Guides on layers | P1 | D |