VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Extract engine command and state helpers
Dylan M. Taylor0b821b3c54d5
diff --git a/crates/engine/src/cmd/appearance.rs b/crates/engine/src/cmd/appearance.rsindex 3e1173d8b..9eee69d27 100644--- a/crates/engine/src/cmd/appearance.rs+++ b/crates/engine/src/cmd/appearance.rs@@ -28,8 +28,11 @@ use vectorcraft_geom::Rect;use super::edit::{outermost, selected_roots};use super::opacitymask::percent;use super::paint::paint_from;-use super::*;use super::{AppearanceAttrs, EyedropperAttrs, FillAttrs, StrokeAttrs};+use super::{+ CommandSpec, NodeId, Result, Session, bad, check_numbers, check_switches, cmd, has_doc, has_selection, id_param, ids_param, index, leaf_targets,+ ok, paint_targets, str_param, switch_or, targets,+};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/assets.rs b/crates/engine/src/cmd/assets.rsindex c560a35c8..975b8e93f 100644--- a/crates/engine/src/cmd/assets.rs+++ b/crates/engine/src/cmd/assets.rs@@ -8,7 +8,7 @@ use vectorcraft_doc::{ExportAsset, NodeId};use super::edit::{roots_of, selected_roots};use super::fileio::{SCREEN_SETTINGS_KEYS, check_screen_settings, export_crop, export_screens, store_screen_settings};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_param, cmd, has_doc, ok, str_param};/// The longest asset name kept (characters).const MAX_NAME: usize = 255;diff --git a/crates/engine/src/cmd/attributes.rs b/crates/engine/src/cmd/attributes.rsindex 7fdc5f1bf..0265b4ccd 100644--- a/crates/engine/src/cmd/attributes.rs+++ b/crates/engine/src/cmd/attributes.rs@@ -10,7 +10,7 @@ use vectorcraft_geom::FillRule;use super::overprint::{AttributesInfo, apply_overprint, edit_counted, overprint_jobs};use super::path::paths_in;-use super::*;+use super::{CommandSpec, NodeId, Result, Session, bad, cmd, has_doc, str_param, targets};/// How many URLs the Attributes panel's recent list keeps.const RECENT_URLS: usize = 10;diff --git a/crates/engine/src/cmd/brushlib.rs b/crates/engine/src/cmd/brushlib.rsindex 1c7de9978..9bb04dac9 100644--- a/crates/engine/src/cmd/brushlib.rs+++ b/crates/engine/src/cmd/brushlib.rs@@ -22,7 +22,7 @@ use super::clipboard::resources::SwatchChoices;use super::patterncmds::add_pattern;use super::swatch::str_list;use super::swatchlib::{FileData, LibraryFile, LibraryInfo, stem};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, str_param};/// The extension of saved brush libraries: native documents.pub const BRUSHES_EXT: &str = vectorcraft_format::EXTENSION;diff --git a/crates/engine/src/cmd/brushsym.rs b/crates/engine/src/cmd/brushsym.rsindex b677b3003..f3c5b3e5b 100644--- a/crates/engine/src/cmd/brushsym.rs+++ b/crates/engine/src/cmd/brushsym.rs@@ -18,7 +18,10 @@ use vectorcraft_geom::{Affine, Point, Vec2};use super::edit::{outermost, selected_roots};use super::pathops::{remove_each, separate};use super::swatch::{anchor, names_param};-use super::*;+use super::{+ CommandSpec, Result, Session, bad, check_numbers, cmd, color_value, find_command, has_doc, has_selection, id_param, ids_param, number_or, ok,+ str_param, switch_or,+};use crate::EngineError;mod brushes;diff --git a/crates/engine/src/cmd/brushsym/brushes.rs b/crates/engine/src/cmd/brushsym/brushes.rsindex 18f744b1d..66dd546e9 100644--- a/crates/engine/src/cmd/brushsym/brushes.rs+++ b/crates/engine/src/cmd/brushsym/brushes.rs@@ -1,4 +1,8 @@-use super::*;+use super::{+ AppearanceItem, Arc, BTreeSet, Bristle, Brush, BrushKind, Color, Document, EngineError, Node, NodeId, NodeKind, Paint, Result, Session, Value,+ anchor, bad, brush, check_numbers, find_command, id_param, ids_json, json, name_param, names_param, ok, roots, selection_art, set_unknown,+ str_param,+};// ---------- brushes ----------diff --git a/crates/engine/src/cmd/brushsym/symbols.rs b/crates/engine/src/cmd/brushsym/symbols.rsindex 63eeed6b5..8e8ba163e 100644--- a/crates/engine/src/cmd/brushsym/symbols.rs+++ b/crates/engine/src/cmd/brushsym/symbols.rs@@ -1,4 +1,8 @@-use super::*;+use super::{+ Affine, AppearanceItem, Arc, CURRENT_SYMBOL, Color, Document, EngineError, FillLayer, HALF, Node, NodeId, NodeKind, Paint, Point, Result,+ SIZES_KEY, Session, Symbol, SymbolExportType, SymbolNineSlice, SymbolRegistration, Value, Vec2, bad, brush, color_value, ids_json, json,+ name_param, number_or, ok, remove_each, roots, selection_art, separate, set_unknown, str_param, switch_or,+};// ---------- symbols ----------diff --git a/crates/engine/src/cmd/clipboard.rs b/crates/engine/src/cmd/clipboard.rsindex a01f095fc..887c5b47a 100644--- a/crates/engine/src/cmd/clipboard.rs+++ b/crates/engine/src/cmd/clipboard.rs@@ -25,7 +25,7 @@ pub use flavours::{AI, BITMAP, EMF, EPS, FILE_HEAD, Flavour, PASTE_ORDER, PDF, Ppub(crate) use resources::SwatchChoices;pub use resources::{ArtResources, art_resources};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, cmd, f64_or, has_doc, point_param, str_param};use crate::DocState;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/clipboard/flavours.rs b/crates/engine/src/cmd/clipboard/flavours.rsindex 08098705f..b7b046824 100644--- a/crates/engine/src/cmd/clipboard/flavours.rs+++ b/crates/engine/src/cmd/clipboard/flavours.rs@@ -12,7 +12,7 @@ use vectorcraft_geom::{Affine, Point};use super::super::fileio;use super::super::place::pt_per_px;-use super::*;+use super::{Clipboard, CommandSpec, Result, Session, always, bad, cmd, f64_or, has_doc, looks_like_svg, point_param, str_param};/// Plain text: a type-only copy's text, else the SVG markup (Include SVG Code).pub const TEXT: &str = "text/plain";diff --git a/crates/engine/src/cmd/colorcmds.rs b/crates/engine/src/cmd/colorcmds.rsindex 6fdc10f40..539785ab1 100644--- a/crates/engine/src/cmd/colorcmds.rs+++ b/crates/engine/src/cmd/colorcmds.rs@@ -18,7 +18,9 @@ use vectorcraft_doc::recolor::{ColorVisitor, Reach, map_links, recolor_node};use vectorcraft_doc::{Document, ImageBlob, Node, NodeId, NodeKind};use super::edit::selected_roots;-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, color_value, f64_or, has_selection, ids_param, str_param, unique_name,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/colormgmt.rs b/crates/engine/src/cmd/colormgmt.rsindex 40144f13e..5c31deb1c 100644--- a/crates/engine/src/cmd/colormgmt.rs+++ b/crates/engine/src/cmd/colormgmt.rs@@ -17,7 +17,9 @@ use vectorcraft_color::{Color, Paint};use vectorcraft_doc::ColorMode;use vectorcraft_render::proof;-use super::*;+#[cfg(not(target_arch = "wasm32"))]+use super::EngineError;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, color_value, has_doc, str_param, targets};/// `Document.unknown` key under which files before format v3 kept the assigned profiles (migrated/// to `Document::color_profiles` on load).diff --git a/crates/engine/src/cmd/colortheme.rs b/crates/engine/src/cmd/colortheme.rsindex 68ec94d6e..9321fc12b 100644--- a/crates/engine/src/cmd/colortheme.rs+++ b/crates/engine/src/cmd/colortheme.rs@@ -9,7 +9,7 @@ use vectorcraft_color::harmony::{Harmony, THEME_SIZE};use vectorcraft_color::recolor::ColorKey;use vectorcraft_tools::params::color_json;-use super::*;+use super::{CommandSpec, Result, Session, always, bad, cmd, color_value, has_doc, str_param};/// A saved colour theme ([`crate::Prefs::color_themes`]).#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]diff --git a/crates/engine/src/cmd/create.rs b/crates/engine/src/cmd/create.rsindex d5588ff44..11c479023 100644--- a/crates/engine/src/cmd/create.rs+++ b/crates/engine/src/cmd/create.rs@@ -5,7 +5,10 @@ use vectorcraft_doc::{Appearance, CharStyle, LiveShape, Node, NodeKind, TextObjeuse vectorcraft_geom::{Affine, Anchor, AnchorKind, FillRule, PathData, Point, Rect, SubPath, shapes};use super::newart::NewArt;-use super::*;+use super::{+ CommandSpec, NodeId, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, color_value, f64_or, f64_req, finite_numbers, has_doc,+ number_or, str_param, switch_or,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/css.rs b/crates/engine/src/cmd/css.rsindex d31656b04..1780cf2be 100644--- a/crates/engine/src/cmd/css.rs+++ b/crates/engine/src/cmd/css.rs@@ -8,7 +8,7 @@ use vectorcraft_doc::NodeId;use vectorcraft_svg::{CssOptions, CssSheet, css_rules};use super::fileio::{default_name, encode_with_warnings, isolated, write_file};-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, has_doc, str_param, targets};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/cut.rs b/crates/engine/src/cmd/cut.rsindex faf905052..90bd276c9 100644--- a/crates/engine/src/cmd/cut.rs+++ b/crates/engine/src/cmd/cut.rs@@ -15,7 +15,7 @@ use vectorcraft_pathops::BoolOp;use super::draw2::{components, erase_outline, ids_json, replace_with_pieces};use super::edit::selected_roots;use super::pathops::{Beside, node_path};-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, finite_numbers, has_selection, point_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/dimension.rs b/crates/engine/src/cmd/dimension.rsindex ec1f91f20..a26eee473 100644--- a/crates/engine/src/cmd/dimension.rs+++ b/crates/engine/src/cmd/dimension.rs@@ -1,5 +1,5 @@//! Linked dimensions: generated groups share the existing text/path render and export pipeline.-use super::*;+use super::{CommandSpec, EngineError, Result, Session, cmd, has_doc};use serde_json::{Value, json};use std::sync::Arc;use vectorcraft_color::{Color, Paint};diff --git a/crates/engine/src/cmd/docinfo.rs b/crates/engine/src/cmd/docinfo.rsindex 0400ab123..7131dd9d4 100644--- a/crates/engine/src/cmd/docinfo.rs+++ b/crates/engine/src/cmd/docinfo.rs@@ -9,7 +9,7 @@ use vectorcraft_doc::{ColorMode, Document, Node, NodeId, NodeKind, RepeatKind, Ruse vectorcraft_geom::{Affine, Rect};use vectorcraft_text::embed::Embedding;-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, cmd, has_doc, has_selection, str_param, targets};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/docmenu.rs b/crates/engine/src/cmd/docmenu.rsindex 88da38361..f1cd09107 100644--- a/crates/engine/src/cmd/docmenu.rs+++ b/crates/engine/src/cmd/docmenu.rs@@ -12,7 +12,10 @@ use vectorcraft_geom::Vec2;use super::edit::selected_roots;use super::pathops::Beside;use super::select::{selectable_ids, walk_selectable};-use super::*;+use super::{+ CommandSpec, EngineError, Point, Result, Session, bad, bool_or, checked_ids_param, cmd, f64_or, f64_req, has_doc, has_selection, id_param, ok,+ str_param,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/docsetup.rs b/crates/engine/src/cmd/docsetup.rsindex 0dc6fbad3..3f7b63225 100644--- a/crates/engine/src/cmd/docsetup.rs+++ b/crates/engine/src/cmd/docsetup.rs@@ -7,7 +7,7 @@ use vectorcraft_doc::{Background, CharPosition, CharStyle, DocSetup, Document, Euse super::flatten::{FlattenOptions, FlattenerPreset};-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, color_value, has_doc};const C: &str = "document.setup";diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rsindex fa4878d2c..9a3b296fc 100644--- a/crates/engine/src/cmd/edit.rs+++ b/crates/engine/src/cmd/edit.rs@@ -8,7 +8,11 @@ use vectorcraft_doc::{Document, Node, NodeId, RulerMode, Unit};use vectorcraft_geom::{Affine, Point, Vec2};use super::clipboard::SwatchChoices;-use super::*;+use super::{+ CommandSpec, Result, Session, always, bad, bool_or, can_clear_history, can_redo, can_undo, checked_ids_param, cmd, f64_or, f64_req,+ finite_numbers, has_clipboard, has_doc, has_selection, has_selection_or_artboard_tool, has_selection_or_guides, id_param, index, ok, point_param,+ str_param,+};use crate::{Clipboard, EngineError, inspect};/// Register editing commands, including document-to-document artwork drops and their parameter contracts.diff --git a/crates/engine/src/cmd/effectcmd.rs b/crates/engine/src/cmd/effectcmd.rsindex e91a621c4..933acc41b 100644--- a/crates/engine/src/cmd/effectcmd.rs+++ b/crates/engine/src/cmd/effectcmd.rs@@ -15,7 +15,7 @@ use vectorcraft_render::effects;use super::appearance::{ItemTarget, aligned, appearance_targets, index_param, item_target, item_target_at, shared_stack};use super::expand::has_seeded;use super::rasterfx;-use super::*;+use super::{CommandSpec, EngineError, NodeId, Result, Session, always, bad, cmd, fileio, has_doc, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/expand.rs b/crates/engine/src/cmd/expand.rsindex efcccd241..b0df586cf 100644--- a/crates/engine/src/cmd/expand.rs+++ b/crates/engine/src/cmd/expand.rs@@ -22,7 +22,7 @@ use super::edit::selected_roots;use super::menucmds::{run_raw, squash};use super::object::as_clipping_path;use super::pathops::{assemble, node_path, outline_strokes, replace_leaves, styled_copy, with_transparency};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, f64_or, has_selection, str_param};const C: &str = "object.expand";/// Expand Gradient To → Specify … Objects: the default and the most.diff --git a/crates/engine/src/cmd/fontfiles.rs b/crates/engine/src/cmd/fontfiles.rsindex c981c24bc..cadbd6509 100644--- a/crates/engine/src/cmd/fontfiles.rs+++ b/crates/engine/src/cmd/fontfiles.rs@@ -12,7 +12,7 @@ use vectorcraft_doc::Document;use vectorcraft_text::{FontDb, FontMatch, WantedFont, WantedFonts};use super::findfiles::{self, Limits, Visitor};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, has_doc};use crate::DocState;/// The most fonts listed, or looked for at once.diff --git a/crates/engine/src/cmd/fonts.rs b/crates/engine/src/cmd/fonts.rsindex f1f7c2dfa..0aaa8ba39 100644--- a/crates/engine/src/cmd/fonts.rs+++ b/crates/engine/src/cmd/fonts.rs@@ -11,7 +11,7 @@ use vectorcraft_doc::{AppearanceItem, Document, Node, NodeId, NodeKind, TextKinduse vectorcraft_geom::Rect;use super::typecmd::refresh_bounds;-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/globaledit.rs b/crates/engine/src/cmd/globaledit.rsindex c015ffaa2..c13687880 100644--- a/crates/engine/src/cmd/globaledit.rs+++ b/crates/engine/src/cmd/globaledit.rs@@ -51,7 +51,7 @@ use vectorcraft_doc::{Appearance, AppearanceItem, Document, FillLayer, Node, Noduse vectorcraft_geom::{Affine, BezPath, PathData, Point, Rect, Shape};use super::wand::{fill_of, stroke_of};-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, cmd, has_doc};const C: &str = "select.globalEdit";const OPTIONS: &str = "select.globalEditOptions";diff --git a/crates/engine/src/cmd/gradient.rs b/crates/engine/src/cmd/gradient.rsindex a861eeb34..92ce8723b 100644--- a/crates/engine/src/cmd/gradient.rs+++ b/crates/engine/src/cmd/gradient.rs@@ -10,7 +10,10 @@ use vectorcraft_tools::params::color_json;use super::appearance::{ItemTarget, edit_items, edits_stroke, item_target};use super::edit::{outermost, selected_roots};use super::paint::swatch_solid;-use super::*;+use super::{+ CommandSpec, NodeId, Result, Session, always, bad, bool_or, check_numbers, check_switches, cmd, color_value, f64_or, has_doc, index,+ leaf_targets, point_param, str_param,+};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/halftone.rs b/crates/engine/src/cmd/halftone.rsindex 7dcb818ab..b97d92ee4 100644--- a/crates/engine/src/cmd/halftone.rs+++ b/crates/engine/src/cmd/halftone.rs@@ -19,7 +19,7 @@ use vectorcraft_pathops::BoolOp;use super::edit::selected_roots;use super::menucmds::isolated_doc;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, color_value, f64_or, has_selection, str_param};pub fn specs() -> Vec<CommandSpec> {vec![cmd!(diff --git a/crates/engine/src/cmd/help.rs b/crates/engine/src/cmd/help.rsindex aba4d608a..e88f00df2 100644--- a/crates/engine/src/cmd/help.rs+++ b/crates/engine/src/cmd/help.rs@@ -3,7 +3,7 @@use serde_json::{Value, json};-use super::*;+use super::{CommandSpec, Result, always, cmd};/// The app's id on getartcraft.com and GitHub.pub const APP_ID: &str = "vectorcraft";@@ -39,6 +39,7 @@ fn url(u: String) -> Result<Value> {#[cfg(test)]mod tests {use super::*;+ use crate::Session;#[test]fn links() {diff --git a/crates/engine/src/cmd/importmatches.rs b/crates/engine/src/cmd/importmatches.rsindex d227b84ed..70d9f461f 100644--- a/crates/engine/src/cmd/importmatches.rs+++ b/crates/engine/src/cmd/importmatches.rs@@ -8,7 +8,7 @@ use std::collections::HashMap;use serde::{Deserialize, Serialize};use serde_json::{Value, json};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, cmd, str_param};use crate::Prefs;/// The most matches kept.diff --git a/crates/engine/src/cmd/inline.rs b/crates/engine/src/cmd/inline.rsindex 68538a5cd..14264fc80 100644--- a/crates/engine/src/cmd/inline.rs+++ b/crates/engine/src/cmd/inline.rs@@ -7,7 +7,7 @@ use vectorcraft_doc::{Document, InlineArt, NodeId, NodeKind, TextRun};use vectorcraft_text::edit;use super::typecmd::refresh_bounds;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, cmd, has_doc, id_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![cmd!(diff --git a/crates/engine/src/cmd/interactivity.rs b/crates/engine/src/cmd/interactivity.rsindex bde136a74..4bcc123dc 100644--- a/crates/engine/src/cmd/interactivity.rs+++ b/crates/engine/src/cmd/interactivity.rs@@ -8,7 +8,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{Document, MAX_SVG_SCRIPTS, NodeId, SVG_EVENTS};use super::overprint::edit_counted;-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, has_doc, str_param, targets};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/intertwine.rs b/crates/engine/src/cmd/intertwine.rsindex 8947a97b5..41e4a467d 100644--- a/crates/engine/src/cmd/intertwine.rs+++ b/crates/engine/src/cmd/intertwine.rs@@ -26,7 +26,7 @@ use vectorcraft_tools::intertwine::{Face, drawn_order, face_at, faces, faces_in,use super::edit::selected_roots;use super::pathops::Beside;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, checked_id, checked_ids_param, cmd, has_selection, point_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rsindex 7b56c2f46..83df1ff3f 100644--- a/crates/engine/src/cmd/layer.rs+++ b/crates/engine/src/cmd/layer.rs@@ -13,7 +13,10 @@ use serde_json::{Value, json};use vectorcraft_doc::{Artboard, Document, LAYER_COLORS, LayerColor, Node, NodeId, NodeKind, Scaling};use vectorcraft_geom::{Affine, Rect};-use super::*;+use super::{+ CommandSpec, Result, Session, bad, bool_or, check_numbers, check_switches, checked_id, checked_ids_param, cmd, color_value, f64_or, has_doc,+ has_selection, id_param, ids_param, index, ok, str_param,+};use crate::EngineError;/// Most rows one panel command takes (ids are untrusted input).diff --git a/crates/engine/src/cmd/layerpanel.rs b/crates/engine/src/cmd/layerpanel.rsindex 5a0e2ec80..39bcdb03f 100644--- a/crates/engine/src/cmd/layerpanel.rs+++ b/crates/engine/src/cmd/layerpanel.rs@@ -10,7 +10,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{Document, Node, NodeId, NodeKind};use super::layer::{NewLayers, row_roots, rows_param};-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, checked_id, cmd, has_doc, id_param, ok};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rsindex 0752c215e..d51c5a916 100644--- a/crates/engine/src/cmd/library.rs+++ b/crates/engine/src/cmd/library.rs@@ -15,7 +15,7 @@ use serde_json::{Map, Value, json};use vectorcraft_color::{Color, Paint};use vectorcraft_doc::TextStyleDef;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, cmd, color_value, has_doc, ids_param, index, ok, point_param, str_param};use crate::Clipboard;/// The extension of a library file.diff --git a/crates/engine/src/cmd/linkfiles.rs b/crates/engine/src/cmd/linkfiles.rsindex bfa7e779e..c874a70ee 100644--- a/crates/engine/src/cmd/linkfiles.rs+++ b/crates/engine/src/cmd/linkfiles.rs@@ -13,7 +13,7 @@ use serde_json::{Value, json};use vectorcraft_doc::NodeKind;use super::findfiles::{self, Limits, Visitor};-use super::*;+use super::{CommandSpec, EngineError, NodeId, Result, Session, always, bad, bool_or, checked_ids_param, cmd};/// The most linked files one search looks for.const MAX_LINKS: usize = 1_000;diff --git a/crates/engine/src/cmd/links.rs b/crates/engine/src/cmd/links.rsindex aef05cc8a..b26cfb557 100644--- a/crates/engine/src/cmd/links.rs+++ b/crates/engine/src/cmd/links.rs@@ -31,7 +31,7 @@ use vectorcraft_doc::{Appearance, Document, ImageBlob, ImageObject, LinkInfo, Nouse vectorcraft_geom::{Affine, Rect, shapes};use super::fileio::{self, RasterImage, absolute_path, file_created, file_stamp, read_file, write_file};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, id_param, ids_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/live.rs b/crates/engine/src/cmd/live.rsindex 1276bdc2a..843445a2b 100644--- a/crates/engine/src/cmd/live.rs+++ b/crates/engine/src/cmd/live.rs@@ -19,7 +19,10 @@ use vectorcraft_geom::{Affine, Anchor, PathData, Point, Vec2};use super::edit::selected_roots;use super::expand::gradient_sampler;use super::pathops::Beside;-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, always, bad, check_numbers, check_switches, cmd, color_value, f64_or, f64_req, finite_numbers,+ has_doc, has_multi, has_selection, id_param, ids_param, number_or, ok, str_param, switch_or,+};mod blend;mod commands;diff --git a/crates/engine/src/cmd/live/blend.rs b/crates/engine/src/cmd/live/blend.rsindex 1ab018a8f..73f092214 100644--- a/crates/engine/src/cmd/live/blend.rs+++ b/crates/engine/src/cmd/live/blend.rs@@ -3,7 +3,10 @@ use super::common::{spacing_param, starts_param, wrap,};use super::mesh::index_param;-use super::*;+use super::{+ Affine, Anchor, Appearance, Arc, Beside, BlendDefaults, BlendOrientation, BlendSpacing, BlendSpec, Document, EngineError, Node, NodeId, NodeKind,+ Paint, PathData, Point, Result, Session, Spine, Value, Vec2, bad, f64_req, id_param, json, live, number_or, ok, str_param, switch_or,+};/// The first blend among `roots`.fn first_blend(d: &Document, roots: &[NodeId]) -> Option<Node> {diff --git a/crates/engine/src/cmd/live/commands.rs b/crates/engine/src/cmd/live/commands.rsindex d46e198e3..82105b00e 100644--- a/crates/engine/src/cmd/live/commands.rs+++ b/crates/engine/src/cmd/live/commands.rs@@ -8,7 +8,7 @@ use super::envelope::{env_set_mesh_point,};use super::mesh::{mesh_add_line, mesh_create, mesh_delete_point, mesh_expand, mesh_move_point, mesh_set_color};-use super::*;+use super::{CommandSpec, always, cmd, has_doc, has_multi, has_selection};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/live/common.rs b/crates/engine/src/cmd/live/common.rsindex 4237f48d3..48f335610 100644--- a/crates/engine/src/cmd/live/common.rs+++ b/crates/engine/src/cmd/live/common.rs@@ -1,5 +1,8 @@use super::mesh::whole;-use super::*;+use super::{+ Arc, BlendEase, BlendEaseType, BlendOrientation, BlendSpacing, Document, EngineError, Node, NodeId, NodeKind, Result, Selection, Session, Value,+ bad, check_numbers, has_selection, ids_param, json, selected_roots, str_param, switch_or,+};pub(super) fn ids_json(ids: &[NodeId]) -> Value {json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>() })diff --git a/crates/engine/src/cmd/live/envelope.rs b/crates/engine/src/cmd/live/envelope.rsindex 27e41509a..e247530c1 100644--- a/crates/engine/src/cmd/live/envelope.rs+++ b/crates/engine/src/cmd/live/envelope.rs@@ -1,6 +1,10 @@use super::common::{fix_ids, ids_json, is_envelope, roots_param, selected_of, wrap};use super::mesh::{handle_param, index_param, whole};-use super::*;+use super::{+ Affine, Appearance, Arc, Beside, Color, Document, EngineError, EnvelopeKind, EnvelopeMap, EnvelopeOptions, Node, NodeId, NodeKind, Paint,+ PathData, Point, PreserveShape, Result, Session, Value, bad, check_numbers, check_switches, f64_or, f64_req, id_param, json, live, ok, str_param,+ switch_or,+};// ---------- Envelope ----------diff --git a/crates/engine/src/cmd/live/mesh.rs b/crates/engine/src/cmd/live/mesh.rsindex 570ef6c92..1d11080fb 100644--- a/crates/engine/src/cmd/live/mesh.rs+++ b/crates/engine/src/cmd/live/mesh.rs@@ -1,6 +1,9 @@use super::common::{fix_ids, ids_json, is_mesh, replace_with, roots_param, selected_of};use super::envelope::{outline_of, rows_cols};-use super::*;+use super::{+ Color, Document, EngineError, EnvelopeKind, GradientMesh, MeshAppearance, Node, NodeKind, Paint, Point, Result, Session, Value, bad,+ check_numbers, color_value, f64_or, f64_req, finite_numbers, gradient_sampler, id_param, json, live, ok, str_param,+};// ---------- Gradient mesh ----------diff --git a/crates/engine/src/cmd/maskedit.rs b/crates/engine/src/cmd/maskedit.rsindex e9283f075..c8dbf8c4d 100644--- a/crates/engine/src/cmd/maskedit.rs+++ b/crates/engine/src/cmd/maskedit.rs@@ -12,7 +12,7 @@ use std::sync::Arc;use serde_json::{Value, json};use vectorcraft_doc::{Document, MaskEdit, Node, NodeId, NodeKind, Selection};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, cmd, has_doc, id_param};/// Name of the temporary mask-editing layer.pub const MASK_EDIT_LAYER: &str = "Opacity Mask Editing";diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rsindex 904e75b4e..6d8f9fd40 100644--- a/crates/engine/src/cmd/menucmds.rs+++ b/crates/engine/src/cmd/menucmds.rs@@ -14,7 +14,10 @@ use vectorcraft_render::AntiAlias;use vectorcraft_render::encode::{RasterExportOptions, RasterFormat};use super::edit::{duplicate_in, selected_roots};-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, fileio, find_command, has_doc, has_selection,+ switch_or,+};/// Session-level (not saved) state owned by the menu commands.#[derive(Clone, Debug, Default)]diff --git a/crates/engine/src/cmd/newart.rs b/crates/engine/src/cmd/newart.rsindex 40424da5a..9401402c5 100644--- a/crates/engine/src/cmd/newart.rs+++ b/crates/engine/src/cmd/newart.rs@@ -16,7 +16,7 @@ use vectorcraft_doc::{Appearance, AppearanceItem, FillLayer, GraphicStyle, Node,use vectorcraft_tools::PaintDefaults;use super::gradient::unplaced;-use super::*;+use super::{CommandSpec, Result, Session, always, cmd};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/newdoc.rs b/crates/engine/src/cmd/newdoc.rsindex 588307f20..d8f0681cc 100644--- a/crates/engine/src/cmd/newdoc.rs+++ b/crates/engine/src/cmd/newdoc.rs@@ -7,7 +7,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{Artboard, Background, ColorMode, Document, Unit};use vectorcraft_geom::{Point, Rect};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, clock_date, cmd, date_param, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/objects_on_path.rs b/crates/engine/src/cmd/objects_on_path.rsindex 52f63ffe0..cbdba5a80 100644--- a/crates/engine/src/cmd/objects_on_path.rs+++ b/crates/engine/src/cmd/objects_on_path.rs@@ -26,7 +26,7 @@ use vectorcraft_doc::{Document, Node, NodeId, NodeKind};use vectorcraft_geom::Rect;use super::edit::{roots_of, selected_roots};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, check_numbers, checked_id, checked_ids_param, cmd, has_selection};/// The id of the Objects on Path tool.pub const TOOL: &str = "objectsOnPath";diff --git a/crates/engine/src/cmd/opacitymask.rs b/crates/engine/src/cmd/opacitymask.rsindex 7a97ab871..05e81260f 100644--- a/crates/engine/src/cmd/opacitymask.rs+++ b/crates/engine/src/cmd/opacitymask.rs@@ -14,7 +14,7 @@ use vectorcraft_doc::{Document, Knockout, Node, NodeId, OpacityMask, Selection};use super::maskedit::{begin, finish, mask_group, mask_parts, show_editing};use super::pathops::{Beside, separate};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, ids_param, ok, targets};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/overprint.rs b/crates/engine/src/cmd/overprint.rsindex 233554aa4..7cab59481 100644--- a/crates/engine/src/cmd/overprint.rs+++ b/crates/engine/src/cmd/overprint.rs@@ -12,7 +12,7 @@ use vectorcraft_geom::FillRule;use super::appearance::{ItemTarget, item_target};use super::edit::selected_roots;-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, cmd, f64_or, has_doc, ids_param, targets};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/package.rs b/crates/engine/src/cmd/package.rsindex 91579a1b9..57f9accae 100644--- a/crates/engine/src/cmd/package.rs+++ b/crates/engine/src/cmd/package.rs@@ -14,7 +14,7 @@ use vectorcraft_doc::{Document, LinkInfo};use serde_json::{Value, json};use super::fileio::{create_dir, write_file};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, str_param, unique_name};const C: &str = "file.package";diff --git a/crates/engine/src/cmd/paint.rs b/crates/engine/src/cmd/paint.rsindex b22d77ac9..d1601420b 100644--- a/crates/engine/src/cmd/paint.rs+++ b/crates/engine/src/cmd/paint.rs@@ -6,7 +6,10 @@ use vectorcraft_doc::{Appearance, CharStyle, Document, Node, NodeId, NodeKind};use super::appearance::{ItemTarget, appearance_targets, edit_items, edit_items_then, item_target};use super::gradient::{item_paint_bounds, place_paint, place_run_paint, run_paint_mut, run_stroke_weight, unplaced};-use super::*;+use super::{+ Affine, CommandSpec, Result, Session, always, bad, bool_or, check_numbers, check_switches, cmd, color_value, has_doc, leaf_targets, ok,+ paint_targets, str_param, switch_or,+};use crate::{DocState, EngineError};pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/panelcmds.rs b/crates/engine/src/cmd/panelcmds.rsindex 5b814b10b..969daf4f6 100644--- a/crates/engine/src/cmd/panelcmds.rs+++ b/crates/engine/src/cmd/panelcmds.rs@@ -5,7 +5,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{Composer, JustificationOptions, NodeKind, Scaling, SingleWordJustify, TextRun};use vectorcraft_geom::{Rect, Vec2};-use super::*;+use super::{Affine, CommandSpec, NodeId, Result, Session, bad, bool_or, check_switches, cmd, has_doc, index, ok, point_indices};use crate::{Clipboard, EngineError};pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/patterncmds.rs b/crates/engine/src/cmd/patterncmds.rsindex b25b427d3..f412452ba 100644--- a/crates/engine/src/cmd/patterncmds.rs+++ b/crates/engine/src/cmd/patterncmds.rs@@ -19,7 +19,10 @@ use vectorcraft_geom::Rect;use super::edit::{outermost, selected_roots};use super::pathops::Beside;-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, f64_or, has_doc, has_selection, ids_param, matrix_param, ok, point_param,+ str_param, targets,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/perspgrid.rs b/crates/engine/src/cmd/perspgrid.rsindex 77f5d158f..5b622f430 100644--- a/crates/engine/src/cmd/perspgrid.rs+++ b/crates/engine/src/cmd/perspgrid.rs@@ -20,7 +20,7 @@ use vectorcraft_tools::distort::perspective::{GridDefinition, PerspectiveGrid};use vectorcraft_tools::{PointerEvent, PointerKind, ToolKey};use super::distortcmds::{grid_of, silent, store_grid};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, has_doc, str_param, switch_or, unique_name};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/plugin.rs b/crates/engine/src/cmd/plugin.rsindex ecddf7cae..610b50c2d 100644--- a/crates/engine/src/cmd/plugin.rs+++ b/crates/engine/src/cmd/plugin.rs@@ -20,7 +20,7 @@ use serde_json::{Map, Value, json};use vectorcraft_doc::{Effect, Node};use vectorcraft_plugins::{Budget, Kind, Plugin, effect, export, objects, registry};-use super::*;+use super::{CommandSpec, EngineError, NodeId, Result, Session, always, bad, cmd, has_doc, ids_param, str_param};/// What a plug-in error looks like to the user. A run the caller cancelled changed nothing.fn err(e: vectorcraft_plugins::Error) -> EngineError {diff --git a/crates/engine/src/cmd/prefscmds.rs b/crates/engine/src/cmd/prefscmds.rsindex bb7fce7c6..9dce65851 100644--- a/crates/engine/src/cmd/prefscmds.rs+++ b/crates/engine/src/cmd/prefscmds.rs@@ -5,7 +5,7 @@use serde_json::{Map, Value, json};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, cmd, str_param};use crate::Prefs;use crate::units::Measure;use vectorcraft_doc::{GridPrefs, Unit};diff --git a/crates/engine/src/cmd/print.rs b/crates/engine/src/cmd/print.rsindex be17271c0..0face3aa8 100644--- a/crates/engine/src/cmd/print.rs+++ b/crates/engine/src/cmd/print.rs@@ -11,7 +11,7 @@ use vectorcraft_pdf::{PrintLayers, PrintOptions, PrintPreview, PrintSettings};use super::fileio::pdf::{merge, pdf_error};use super::fileio::{extension, write_or_return};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, str_param};const SETUP: &str = "print.setup";diff --git a/crates/engine/src/cmd/printadvanced.rs b/crates/engine/src/cmd/printadvanced.rsindex 301f696df..d181541c3 100644--- a/crates/engine/src/cmd/printadvanced.rs+++ b/crates/engine/src/cmd/printadvanced.rs@@ -14,7 +14,7 @@ use vectorcraft_render::{AntiAlias, RenderOptions};use super::fileio::pdf::pdf_error;use super::flatten::{FlattenOptions, FlattenerPreset, flatten_document};use super::menucmds::{MAX_PIXELS, unique_key};-use super::*;+use super::{EngineError, Result, bad};/// The flattener options of `set`'s preset (`None`: transparency prints live); an error naming/// `cmd` for a preset that is neither built in nor in `saved`.diff --git a/crates/engine/src/cmd/printpresets.rs b/crates/engine/src/cmd/printpresets.rsindex a27c5fa82..8f0dd298d 100644--- a/crates/engine/src/cmd/printpresets.rs+++ b/crates/engine/src/cmd/printpresets.rs@@ -8,7 +8,7 @@ use vectorcraft_pdf::PrintSettings;use super::fileio::pdf::changed;use super::print::settings_over;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, str_param, unique_name};/// The built-in preset's name.pub const DEFAULT_PRESET: &str = "[Default]";diff --git a/crates/engine/src/cmd/printtiling.rs b/crates/engine/src/cmd/printtiling.rsindex 690ef6196..6c683ac79 100644--- a/crates/engine/src/cmd/printtiling.rs+++ b/crates/engine/src/cmd/printtiling.rs@@ -10,7 +10,7 @@ use vectorcraft_pdf::{TileOrigin, TilingPage};use super::fileio::pdf::pdf_error;use super::print::{settings, to_json};-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, cmd, has_doc, index};const SET: &str = "print.tiling.set";diff --git a/crates/engine/src/cmd/rasterfx.rs b/crates/engine/src/cmd/rasterfx.rsindex ae88da1fa..0d673aac5 100644--- a/crates/engine/src/cmd/rasterfx.rs+++ b/crates/engine/src/cmd/rasterfx.rs@@ -26,7 +26,7 @@ use vectorcraft_geom::{Affine, FillRule, PathData, Rect};use vectorcraft_render::effects::{self, RasterFx};use vectorcraft_render::{AntiAlias, RenderOptions};-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, has_doc};mod report;use report::FlattenReport;diff --git a/crates/engine/src/cmd/recolor.rs b/crates/engine/src/cmd/recolor.rsindex 52431090c..8a4fbb09d 100644--- a/crates/engine/src/cmd/recolor.rs+++ b/crates/engine/src/cmd/recolor.rs@@ -13,7 +13,7 @@ use vectorcraft_doc::swatches::{node_colors, node_paints};use vectorcraft_doc::{Document, Node, NodeId, NodeKind};use super::colorcmds::{Recolor, Scope};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, checked_ids_param, cmd, color_value, has_doc, index, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/recovery.rs b/crates/engine/src/cmd/recovery.rsindex 28f7bf592..753fad69c 100644--- a/crates/engine/src/cmd/recovery.rs+++ b/crates/engine/src/cmd/recovery.rs@@ -43,7 +43,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{Document, ImageBlob};use super::fileio::{self, SAVE_FORMATS, SaveJob, SaveMode, SavePlan};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, cmd, str_param};use crate::DocState;/// Documents with more objects than this are complex: with Preferences → Turn off Data Recoverydiff --git a/crates/engine/src/cmd/scripts.rs b/crates/engine/src/cmd/scripts.rsindex bf3149bcb..d175b4469 100644--- a/crates/engine/src/cmd/scripts.rs+++ b/crates/engine/src/cmd/scripts.rs@@ -11,7 +11,7 @@ use vectorcraft_scriptcheck::{Limits, Loaded, Loader, Report};/// The ids a reply can hold, for the windows that show it.pub use vectorcraft_scriptcheck::{IncludeStatus, Need, OUTSIDE, PROBLEMS};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, str_param};/// The extensions of the scripts File › Open shows a check for.pub const EXTS: &[&str] = &["jsx", "jsxinc", "jsxbin"];diff --git a/crates/engine/src/cmd/select.rs b/crates/engine/src/cmd/select.rsindex 26f90aa1f..b8b04482f 100644--- a/crates/engine/src/cmd/select.rs+++ b/crates/engine/src/cmd/select.rs@@ -7,7 +7,9 @@ use vectorcraft_color::Paint;use vectorcraft_doc::{Document, Node, NodeId, NodeKind};use super::wand::{fill_of, stroke_of};-use super::*;+use super::{+ CommandSpec, Result, Session, bad, bool_or, checked_id, checked_ids_param, cmd, color_value, has_doc, has_selection, index, ok, str_param,+};use crate::DocState;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/shaper.rs b/crates/engine/src/cmd/shaper.rsindex a65ab3e47..0ba4ebc0d 100644--- a/crates/engine/src/cmd/shaper.rs+++ b/crates/engine/src/cmd/shaper.rs@@ -2,7 +2,7 @@//! art retained underneath. Recipes select topology regions; source edits re-evaluate them in//! the same undo transaction. Rendering and exporters only see ordinary groups and paths.use super::pathops::Beside;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_param, cmd, f64_or, has_doc, id_param, point_param};use serde_json::{Value, json};use std::{collections::BTreeMap, sync::Arc};use vectorcraft_doc::shaper::{EdgeEdit, FILL_PREFIX, FaceEdit, FaceSelector, SOURCES, STROKE_PREFIX, ShaperSpec};diff --git a/crates/engine/src/cmd/shortcutset.rs b/crates/engine/src/cmd/shortcutset.rsindex cda276b6d..ad36b989c 100644--- a/crates/engine/src/cmd/shortcutset.rs+++ b/crates/engine/src/cmd/shortcutset.rs@@ -13,7 +13,7 @@use serde_json::{Value, json};-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, cmd, importmatches, str_param};/// The most bytes of a file read.const MAX_BYTES: usize = 4 << 20;diff --git a/crates/engine/src/cmd/slices.rs b/crates/engine/src/cmd/slices.rsindex 57e3b30bb..cad1335c1 100644--- a/crates/engine/src/cmd/slices.rs+++ b/crates/engine/src/cmd/slices.rs@@ -12,7 +12,10 @@ use vectorcraft_doc::slices::valid_rect;use vectorcraft_doc::{Appearance, CellAlign, CellVAlign, Document, Node, NodeKind, Slice, SliceKind, SliceOptions};use vectorcraft_geom::{Rect, shapes};-use super::*;+use super::{+ CommandSpec, EngineError, NodeId, Result, Session, bad, bool_or, cmd, f64_or, f64_req, has_doc, has_selection, id_param, ids_param, index,+ targets,+};/// The most slices one Divide Slices makes.const MAX_PIECES: usize = 1000;diff --git a/crates/engine/src/cmd/stroke.rs b/crates/engine/src/cmd/stroke.rsindex fccb1588c..03b927cd3 100644--- a/crates/engine/src/cmd/stroke.rs+++ b/crates/engine/src/cmd/stroke.rs@@ -9,7 +9,7 @@ use vectorcraft_doc::{use super::appearance::{ItemTarget, edit_items, item_target};use super::paint::painted;-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, ok, str_param};use crate::DocState;use crate::inspect::{ALIGNS, CAPS, JOINS, StrokeMixed, node_stroke, scale_layer};diff --git a/crates/engine/src/cmd/style.rs b/crates/engine/src/cmd/style.rsindex 486aa0d4e..a15ea9ff4 100644--- a/crates/engine/src/cmd/style.rs+++ b/crates/engine/src/cmd/style.rs@@ -20,7 +20,7 @@ use vectorcraft_color::Paint;use vectorcraft_doc::{Appearance, DEFAULT_GRAPHIC_STYLE, Document, GraphicStyle, Node, NodeId, NodeKind};use vectorcraft_geom::Rect;-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, id_param, index, ok, str_param, unique_name};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/stylelib.rs b/crates/engine/src/cmd/stylelib.rsindex d1905142f..cb36fb407 100644--- a/crates/engine/src/cmd/stylelib.rs+++ b/crates/engine/src/cmd/stylelib.rs@@ -16,7 +16,7 @@ use vectorcraft_doc::{Document, GraphicStyle, PatternDef, StyleLibrary};use super::menucmds::squash;use super::swatch::str_list;use super::swatchlib::{FileData, LibraryFile, LibraryInfo, stem};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, str_param, unique_name};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/swatch.rs b/crates/engine/src/cmd/swatch.rsindex 8c78d49e0..8de986583 100644--- a/crates/engine/src/cmd/swatch.rs+++ b/crates/engine/src/cmd/swatch.rs@@ -7,7 +7,10 @@ use vectorcraft_doc::swatches::{LinkFn, color_name, node_colors};use vectorcraft_doc::{Document, NodeId};use super::paint::paint_from;-use super::*;+use super::{+ CommandSpec, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, color_value, has_doc, index, ok, str_param, switch_or,+ unique_name,+};use crate::EngineError;pub fn specs() -> Vec<CommandSpec> {diff --git a/crates/engine/src/cmd/swatchlib.rs b/crates/engine/src/cmd/swatchlib.rsindex 36c67f696..b6dbde7fc 100644--- a/crates/engine/src/cmd/swatchlib.rs+++ b/crates/engine/src/cmd/swatchlib.rs@@ -18,7 +18,7 @@ use super::fileio::{create_dir, extension, read_file, write_file, write_new_fileuse super::menucmds::squash;use super::package::free_name;use super::swatch::{map_default_paints, str_list, swatch_json};-use super::*;+use super::{Color, CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/symbollib.rs b/crates/engine/src/cmd/symbollib.rsindex 557eb9ba6..3f0c80944 100644--- a/crates/engine/src/cmd/symbollib.rs+++ b/crates/engine/src/cmd/symbollib.rs@@ -20,7 +20,7 @@ use super::clipboard::Clipboard;use super::clipboard::resources::SwatchChoices;use super::swatch::str_list;use super::swatchlib::{FileData, LibraryFile, LibraryInfo, stem};-use super::*;+use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, number_or, str_param};/// The extension of saved symbol libraries: native documents.pub const SYMBOLS_EXT: &str = vectorcraft_format::EXTENSION;diff --git a/crates/engine/src/cmd/tabs.rs b/crates/engine/src/cmd/tabs.rsindex 766335ca6..193ced2f7 100644--- a/crates/engine/src/cmd/tabs.rs+++ b/crates/engine/src/cmd/tabs.rs@@ -4,7 +4,7 @@ use serde_json::{Value, json};use vectorcraft_doc::{NodeKind, TabAlign, TabStop};use super::typecmd::{TextRange, para_span, refresh_bounds, text_targets};-use super::*;+use super::{CommandSpec, Result, Session, bad, cmd, has_selection};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/textedit.rs b/crates/engine/src/cmd/textedit.rsindex 4b8b368f4..92a2758ee 100644--- a/crates/engine/src/cmd/textedit.rs+++ b/crates/engine/src/cmd/textedit.rs@@ -9,7 +9,10 @@ use vectorcraft_text::edit;use super::stroke::StrokeChange;use super::typecmd::refresh_bounds;-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, color_value, has_doc, has_selection, id_param,+ index, number_or, point_param, str_param, switch_or, targets,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/textstyles.rs b/crates/engine/src/cmd/textstyles.rsindex 3667169a4..08426e6c6 100644--- a/crates/engine/src/cmd/textstyles.rs+++ b/crates/engine/src/cmd/textstyles.rs@@ -11,7 +11,7 @@ use serde_json::{Map, Value, json};use vectorcraft_doc::{CharStyle, Document, NodeId, NodeKind, ParaStyle, TextStyleDef};use super::typecmd::{refresh_bounds, text_targets};-use super::*;+use super::{CommandSpec, Result, Run, Session, bad, bool_or, has_doc, id_param, index, ok, str_param};pub const NORMAL_CHAR: &str = "[Normal Character Style]";pub const NORMAL_PARA: &str = "[Normal Paragraph Style]";diff --git a/crates/engine/src/cmd/textwrap.rs b/crates/engine/src/cmd/textwrap.rsindex 862d447d2..1315f6da6 100644--- a/crates/engine/src/cmd/textwrap.rs+++ b/crates/engine/src/cmd/textwrap.rs@@ -9,7 +9,7 @@ use vectorcraft_doc::{Document, Node, NodeId, NodeKind, TextKind, TextWrap, Wrapuse vectorcraft_geom::{PathData, shapes};use super::typecmd::refresh_bounds;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bool_or, checked_ids_or_selection, cmd, f64_or, has_selection};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/threads.rs b/crates/engine/src/cmd/threads.rsindex 4382ae0b2..3bb35b979 100644--- a/crates/engine/src/cmd/threads.rs+++ b/crates/engine/src/cmd/threads.rs@@ -10,7 +10,7 @@ use vectorcraft_doc::{Document, Node, NodeId, NodeKind, TextKind, TextObject, Teuse super::edit::selected_roots;use super::typecmd::refresh_bounds;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, checked_id, cmd, finite_numbers, has_doc, has_multi, has_selection, ok, switch_or};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/typecmd.rs b/crates/engine/src/cmd/typecmd.rsindex e0cb73a1c..aedbd35a4 100644--- a/crates/engine/src/cmd/typecmd.rs+++ b/crates/engine/src/cmd/typecmd.rs@@ -9,7 +9,10 @@ use vectorcraft_geom::{Affine, PathData, Vec2};use super::edit::selected_roots;use super::pathops::{len_param, num_param, shape_node};-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, bad, check_numbers, cmd, color_value, f64_req, has_doc, has_selection, id_param, index, number_or, ok,+ str_param, switch_or, targets,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/typecmd/area_tests.rs b/crates/engine/src/cmd/typecmd/area_tests.rsindex a844d0083..4bde140a7 100644--- a/crates/engine/src/cmd/typecmd/area_tests.rs+++ b/crates/engine/src/cmd/typecmd/area_tests.rs@@ -536,6 +536,24 @@ fn numbered_lists_are_set_per_paragraph_saved_and_styled() {assert_eq!((list(&s, 0), list(&s, 1), list(&s, 2)), (None, None, None));}+/// The text object `id`.+fn text_at(s: &Session, id: u64) -> vectorcraft_doc::text::TextObject {+ match &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind {+ NodeKind::Text(t) => (**t).clone(),+ _ => panic!("text"),+ }+}++/// How many list markers text object `id` draws.+fn marker_count(s: &Session, id: u64) -> usize {+ vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &text_at(s, id)).markers.len()+}++/// The tab stops of paragraph `k` of text object `id`.+fn tab_stops(s: &Session, id: u64, k: usize) -> Vec<(f64, vectorcraft_doc::TabAlign, String)> {+ text_at(s, id).para_at(k).tabs.iter().map(|t| (t.position, t.align, t.leader.clone())).collect()+}+/// The glyphs the layout of type `id` draws, each with its glyph, where it is drawn and the/// transform it is drawn with (in thousandths), from the top line down and left to right.fn drawn_glyphs(s: &Session, id: u64) -> Vec<(u32, i64, i64, [i64; 6])> {@@ -566,13 +584,7 @@ fn convert_to_text_writes_the_markers_where_they_were_drawn() {use vectorcraft_doc::text::{Bullet, ParaList};let mut s = Session::new();s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();- let text = |s: &Session, id: u64| match &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind {- NodeKind::Text(t) => (**t).clone(),- _ => panic!("text"),- };- let markers = |s: &Session, id: u64| vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &text(s, id)).markers.len();- let tabs =- |s: &Session, id: u64, k: usize| text(s, id).para_at(k).tabs.iter().map(|t| (t.position, t.align, t.leader.clone())).collect::<Vec<_>>();+ let (text, markers, tabs) = (text_at, marker_count, tab_stops);let long = "The quick brown fox jumps over the lazy dog and runs far away into the woods beyond the hill";let id = s.execute("text.create", &json!({"x": 10, "y": 10, "text": format!("One\n{long}\n\nFour\nFive"), "area": {"width": 200, "height": 400}}))@@ -691,14 +703,19 @@ fn convert_to_text_writes_the_markers_where_they_were_drawn() {s.execute("text.convertListToText", &json!({"ids": [id]})).unwrap();assert_eq!((text(&s, id).plain_text().as_str(), tabs(&s, id, 1)), (text_after, stop), "{size} pt");}+ point_and_vertical_type_convert(&mut s);+}++/// Point type and vertical type convert too, and type with no list paragraph has nothing to convert.+fn point_and_vertical_type_convert(s: &mut Session) {// Point type and vertical type.for vertical in [false, true] {let id = s.execute("text.create", &json!({"x": 400, "y": 700, "vertical": vertical, "text": "One\nTwo"})).unwrap()["id"].as_u64().unwrap();s.execute("text.setFormat", &json!({"ids": [id], "list": "number"})).unwrap();- let before = drawn_glyphs(&s, id);+ let before = drawn_glyphs(s, id);s.execute("text.convertListToText", &json!({"ids": [id]})).unwrap();- assert_eq!(drawn_glyphs(&s, id), before, "vertical {vertical}");- assert_eq!(text(&s, id).plain_text(), "1.\tOne\n2.\tTwo");+ assert_eq!(drawn_glyphs(s, id), before, "vertical {vertical}");+ assert_eq!(text_at(s, id).plain_text(), "1.\tOne\n2.\tTwo");}// Type with no list paragraph: nothing to convert and no undo step.let plain = s.execute("text.create", &json!({"x": 10, "y": 700, "text": "Plain"})).unwrap()["id"].as_u64().unwrap();diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rsindex 74d94ed80..6df2ee6ce 100644--- a/crates/engine/src/cmd/typemenu.rs+++ b/crates/engine/src/cmd/typemenu.rs@@ -7,7 +7,9 @@ use vectorcraft_doc::{CharStyle, Document, Justify, NodeId, NodeKind, Quotes, Teuse vectorcraft_geom::{Affine, Rect, shapes};use super::typecmd::refresh_bounds;-use super::*;+use super::{+ CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, find_command, has_clipboard, has_doc, has_selection, ids_param, str_param, targets,+};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rsindex be5fec64a..116149ec7 100644--- a/crates/engine/src/cmd/variablecmds.rs+++ b/crates/engine/src/cmd/variablecmds.rs@@ -19,7 +19,7 @@ use vectorcraft_doc::{DataSet, DataValue, NodeId, NodeKind, Variable, VariableKiuse super::edit::selected_roots;use super::fileio::{absolute_path, read_file_head, write_file};use super::textedit::set_plain_text;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_or_selection, cmd, has_doc, has_selection, links, str_param};mod csv;mod library;diff --git a/crates/engine/src/cmd/variablecmds/csv.rs b/crates/engine/src/cmd/variablecmds/csv.rsindex 6cb10284b..95d80ce28 100644--- a/crates/engine/src/cmd/variablecmds/csv.rs+++ b/crates/engine/src/cmd/variablecmds/csv.rs@@ -1,4 +1,7 @@-use super::*;+use super::{+ BTreeMap, BTreeSet, DataSet, DataValue, EngineError, MAX_NAME, Result, Session, Value, Variable, VariableKind, Variables, absolute_path, bad,+ json, read_file_head, str_param, variables_unlocked, write_file,+};/// Cap on a graph variable's CSV (MCP and files are untrusted).pub(super) const MAX_GRAPH_CSV: usize = 256 * 1024;diff --git a/crates/engine/src/cmd/variablecmds/library.rs b/crates/engine/src/cmd/variablecmds/library.rsindex 83374a16d..937d4155e 100644--- a/crates/engine/src/cmd/variablecmds/library.rs+++ b/crates/engine/src/cmd/variablecmds/library.rs@@ -1,4 +1,7 @@-use super::*;+use super::{+ BTreeMap, BTreeSet, DataSet, DataValue, EngineError, MAX_NAME, Result, Session, Value, Variable, VariableKind, absolute_path, bad, json, named,+ read_file_head, str_param, variables_unlocked,+};/// Caps on a variable library (paths and MCP payloads are untrusted): its size, its XML nodes, how/// deep its elements nest, and the entities, variables and data sets it declares.diff --git a/crates/engine/src/cmd/views.rs b/crates/engine/src/cmd/views.rsindex 0364c2958..8a688b05b 100644--- a/crates/engine/src/cmd/views.rs+++ b/crates/engine/src/cmd/views.rs@@ -5,7 +5,7 @@ use serde_json::{Value, json};use vectorcraft_doc::SavedView;use vectorcraft_geom::Point;-use super::*;+use super::{CommandSpec, Result, Session, bad, bool_or, cmd, f64_req, finite_numbers, has_doc, str_param};pub fn specs() -> Vec<CommandSpec> {vec![diff --git a/crates/engine/src/cmd/wand.rs b/crates/engine/src/cmd/wand.rsindex 362043c3d..6e89a7544 100644--- a/crates/engine/src/cmd/wand.rs+++ b/crates/engine/src/cmd/wand.rs@@ -8,7 +8,7 @@ use vectorcraft_color::Paint;use vectorcraft_doc::{Document, Node, NodeId, NodeKind};use super::select::selectable_ids;-use super::*;+use super::{CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, has_doc, id_param, str_param};/// Magic Wand panel settings. Tolerances: colours as 0–255 RGB distance, stroke weight in/// points, opacity in percent.diff --git a/crates/engine/src/command_sets.rs b/crates/engine/src/command_sets.rsindex 8f3f35528..3044e17bf 100644--- a/crates/engine/src/command_sets.rs+++ b/crates/engine/src/command_sets.rs@@ -1,4 +1,4 @@-use super::*;+use super::{NodeId, Value, cmd};/// The commands that act on the active artboard (#693), which the app passes as their `artboard`:/// Paste in Place, in Front and in Back paste onto it, Align to Artboard aligns to it, Distributediff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rsindex 403d771d7..299f2f000 100644--- a/crates/engine/src/doc_state.rs+++ b/crates/engine/src/doc_state.rs@@ -1,7 +1,7 @@use super::error::{EngineError, Result};use super::history::{History, HistoryEntry};use super::interaction::{Interaction, LastTransform, UndoGroup};-use super::*;+use super::{Arc, Document, NodeId, NodeKind, Selection, Value, cmd, file_access};/// Per-document editing state.#[derive(Clone, Debug)]diff --git a/crates/engine/src/error.rs b/crates/engine/src/error.rsindex f894e516a..8d939db77 100644--- a/crates/engine/src/error.rs+++ b/crates/engine/src/error.rs@@ -1,4 +1,4 @@-use super::*;+use super::{NodeId, cancel};#[derive(Debug, thiserror::Error)]pub enum EngineError {diff --git a/crates/engine/src/history.rs b/crates/engine/src/history.rsindex f82ba3079..ec53acd5b 100644--- a/crates/engine/src/history.rs+++ b/crates/engine/src/history.rs@@ -1,4 +1,4 @@-use super::*;+use super::{Arc, Document, Selection};/// One undo step.#[derive(Clone, Debug)]diff --git a/crates/engine/src/interaction.rs b/crates/engine/src/interaction.rsindex 986e9e566..b1d11a479 100644--- a/crates/engine/src/interaction.rs+++ b/crates/engine/src/interaction.rs@@ -1,4 +1,4 @@-use super::*;+use super::{Affine, Arc, Document, NodeId, Selection, Value};/// An in-progress drag: the snapshot the previews are applied to.#[derive(Clone, Debug)]diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rsindex fad473449..c6e76b4e8 100644--- a/crates/engine/src/prefs.rs+++ b/crates/engine/src/prefs.rs@@ -1,4 +1,4 @@-use super::*;+use super::{Color, EyedropperOptions, PathfinderOptions, Value, cmd};/// Where new art goes (Illustrator's drawing modes, Shift+D cycles).#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]diff --git a/crates/engine/src/sanity.rs b/crates/engine/src/sanity.rsindex 0d06450a8..b28cc23ca 100644--- a/crates/engine/src/sanity.rs+++ b/crates/engine/src/sanity.rs@@ -1,4 +1,4 @@-use super::*;+use super::{Document, MAX_COORD, NodeId, NodeKind, Selection, cmd};/// Is `id` a path made into a guide (View → Guides → Make Guides)?pub(crate) fn is_guide_path(d: &Document, id: NodeId) -> bool {diff --git a/crates/engine/src/session.rs b/crates/engine/src/session.rsindex 2dd1bc889..1eaf15b88 100644--- a/crates/engine/src/session.rs+++ b/crates/engine/src/session.rs@@ -5,7 +5,10 @@ use super::history::NamedStep;use super::interaction::{BatchSteps, Interaction, LastTransform, UndoGroup, UndoScope};use super::prefs::{DrawMode, Prefs};use super::sanity::{TOO_DEEP, deselect_hidden, doc_sane, objects_in_range};-use super::*;+use super::{+ Arc, Clipboard, Color, CommandInfo, CommandSpec, Document, GradientPaint, Journal, NodeId, NodeKind, PaintDefaults, Selection, Session, Value,+ ViewInfo, cmd, command_specs, file_access, find_command, guard,+};mod documents;mod edit;diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rsindex b0bf0f792..89d846330 100644--- a/crates/engine/src/session/documents.rs+++ b/crates/engine/src/session/documents.rs@@ -1,4 +1,7 @@-use super::*;+use super::{+ Arc, Clipboard, Color, CommandInfo, DocState, Document, DrawMode, EngineError, GradientPaint, Journal, NodeKind, PaintDefaults, Prefs, Result,+ Session, ViewInfo, cmd, command_specs, file_access,+};impl Session {/// A session with no document open, the default preferences and the Selection tool. It alsodiff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rsindex 6e9267720..78ba405be 100644--- a/crates/engine/src/session/edit.rs+++ b/crates/engine/src/session/edit.rs@@ -1,4 +1,7 @@-use super::*;+use super::{+ Arc, Document, EngineError, Interaction, LastTransform, NamedStep, Result, Selection, Session, TOO_DEEP, Value, cmd, deselect_hidden, doc_sane,+ objects_in_range,+};impl Session {/// Run `f` on a mutable copy of the active document. Outside an interaction this records onediff --git a/crates/engine/src/session/execute.rs b/crates/engine/src/session/execute.rsindex 45ede81e5..bede24c7e 100644--- a/crates/engine/src/session/execute.rs+++ b/crates/engine/src/session/execute.rs@@ -1,4 +1,6 @@-use super::*;+use super::{+ CommandSpec, EngineError, NodeId, Result, SELECTS_GIVEN_IDS, Selection, Session, Value, cmd, find_command, given_ids, guard, strip_replay_only,+};impl Session {/// `spec`'s `enabled` with `ids` selected instead of the selection, which is then put back.diff --git a/crates/engine/src/session/undo.rs b/crates/engine/src/session/undo.rsindex f9f06135f..2f750dc13 100644--- a/crates/engine/src/session/undo.rs+++ b/crates/engine/src/session/undo.rs@@ -1,4 +1,4 @@-use super::*;+use super::{Arc, BatchSteps, Document, Session, UndoGroup, UndoScope, Value, cmd, deselect_hidden};impl Session {// ---------- undo groups (scrubbed numeric fields) ----------diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rsindex 383fe2143..1be9fa5fb 100644--- a/crates/engine/src/tests/menucmds.rs+++ b/crates/engine/src/tests/menucmds.rs@@ -2601,13 +2601,18 @@ fn guides_and_art_move_together_when_selected() {assert!(s.doc().unwrap().doc.node(copied_id).is_none());assert!(s.doc().unwrap().doc.node(a).is_some());+ guides_and_art_later_cases(&mut s, a);+}++/// Cases 5 to 8 of [`guides_and_art_move_together_when_selected`]: explicit ids, preview copies and moving a guide.+fn guides_and_art_later_cases(s: &mut Session, a: NodeId) {// 5. Explicit ids: only the specified art moves, guides stay put.- sel(&mut s, &[a]);+ sel(s, &[a]);s.execute("guide.select", &json!({"indexes": [0, 1], "toggle": true})).unwrap();s.execute("object.transform", &json!({"ids": [a.0], "matrix": [1, 0, 0, 1, 40, 50]})).unwrap();let b = s.doc().unwrap().doc.bounds_of(&[a], false).unwrap();assert_eq!((b.x0, b.y0), (50.0, 60.0));- assert_eq!(guides(&s), vec![(true, 200.0), (false, 300.0)]);+ assert_eq!(guides(s), vec![(true, 200.0), (false, 300.0)]);s.execute("edit.undo", &json!({})).unwrap();// 6. Interactive preview copies: dragging with Alt previews the copies and commit keeps them.@@ -2615,32 +2620,32 @@ fn guides_and_art_move_together_when_selected() {s.preview("object.transform", &json!({"matrix": [1, 0, 0, 1, 10, 20], "copy": true})).unwrap();s.preview("object.transform", &json!({"matrix": [1, 0, 0, 1, 30, 40], "copy": true})).unwrap();s.commit_interaction().unwrap();- assert_eq!(guides(&s).len(), 4);- assert_eq!(guides(&s)[2], (true, 230.0));- assert_eq!(guides(&s)[3], (false, 340.0));+ assert_eq!(guides(s).len(), 4);+ assert_eq!(guides(s)[2], (true, 230.0));+ assert_eq!(guides(s)[3], (false, 340.0));s.execute("edit.undo", &json!({})).unwrap();- assert_eq!(guides(&s), vec![(true, 200.0), (false, 300.0)]);+ assert_eq!(guides(s), vec![(true, 200.0), (false, 300.0)]);// 7. Dragging a guide (guide.move) when art is also selected moves both art and guides.- sel(&mut s, &[a]);+ sel(s, &[a]);s.execute("guide.select", &json!({"indexes": [0, 1], "toggle": true})).unwrap();s.execute("guide.move", &json!({"dx": 10, "dy": 20})).unwrap();let b = s.doc().unwrap().doc.bounds_of(&[a], false).unwrap();assert_eq!((b.x0, b.y0), (20.0, 30.0));- assert_eq!(guides(&s), vec![(true, 210.0), (false, 320.0)]);+ assert_eq!(guides(s), vec![(true, 210.0), (false, 320.0)]);s.execute("edit.undo", &json!({})).unwrap();let b = s.doc().unwrap().doc.bounds_of(&[a], false).unwrap();assert_eq!((b.x0, b.y0), (10.0, 10.0));- assert_eq!(guides(&s), vec![(true, 200.0), (false, 300.0)]);+ assert_eq!(guides(s), vec![(true, 200.0), (false, 300.0)]);// 8. Copy-dragging a guide (guide.move { copy: true }) when art is also selected duplicates both.s.execute("guide.move", &json!({"dx": 10, "dy": 20, "copy": true})).unwrap();- assert_eq!(guides(&s).len(), 4);- assert_eq!(guides(&s)[2], (true, 210.0));- assert_eq!(guides(&s)[3], (false, 320.0));+ assert_eq!(guides(s).len(), 4);+ assert_eq!(guides(s)[2], (true, 210.0));+ assert_eq!(guides(s)[3], (false, 320.0));assert_eq!(s.doc().unwrap().doc.layers[0].children().unwrap().len(), 2);s.execute("edit.undo", &json!({})).unwrap();- assert_eq!(guides(&s).len(), 2);+ assert_eq!(guides(s).len(), 2);assert_eq!(s.doc().unwrap().doc.layers[0].children().unwrap().len(), 1);}diff --git a/crates/engine/src/tests/panelcmds.rs b/crates/engine/src/tests/panelcmds.rsindex 725bdd0b9..21ebd76ec 100644--- a/crates/engine/src/tests/panelcmds.rs+++ b/crates/engine/src/tests/panelcmds.rs@@ -656,23 +656,30 @@ fn new_art_on_a_locked_artboard_stays_editable_until_the_selection_leaves_it() {assert_eq!(selected(&s), pasted);s.execute("object.move", &json!({"dx": 10, "dy": 0})).unwrap();assert_eq!(left(&s, pasted[0]), 1160.0);+ batches_and_isolation_keep_new_art_protected(&mut s, pasted);+}++/// The batch, isolation and group cases of [`new_art_on_a_locked_artboard_stays_editable_until_the_selection_leaves_it`],+/// with the pasted art `pasted` selected.+fn batches_and_isolation_keep_new_art_protected(s: &mut Session, pasted: Vec<u64>) {+ let selected = |s: &Session| s.doc().unwrap().selection.objects.iter().map(|id| id.0).collect::<Vec<_>>();let editable = |s: &Session| s.doc().unwrap().doc.is_editable(NodeId(pasted[0]));// A batch that deselects it and fails brings it back selected and editable, and so does// undoing a batch that deselects it and draws.let failed = json!({"commands": [{"command": "select.none"}, {"command": "no.such.command"}]});assert!(s.execute("command.batch", &failed).is_err());- assert_eq!((selected(&s), editable(&s)), (pasted.clone(), true), "after a failed batch");+ assert_eq!((selected(s), editable(s)), (pasted.clone(), true), "after a failed batch");let drawn =json!({"commands": [{"command": "select.none"}, {"command": "shape.rectangle", "params": {"x": 300, "y": 300, "width": 20, "height": 20}}]});s.execute("command.batch", &drawn).unwrap();- assert!(!editable(&s), "deselected by the batch");+ assert!(!editable(s), "deselected by the batch");// Undo inside a later batch gives the document the new art of the selection it brings back:// the unlocked artboard over that art then moves it along.let up = json!({"command": "artboard.move", "params": {"index": 2, "dx": 0, "dy": 1000, "moveArt": true}});let r = s.execute("command.batch", &json!({"commands": [{"command": "edit.undo"}, up.clone()]})).unwrap();assert!(ids(&r["results"][1]["moved"]).contains(&pasted[0]), "undone inside a batch: {r}");s.execute("edit.undo", &json!({})).unwrap();- assert_eq!((selected(&s), editable(&s)), (pasted.clone(), true), "the batch undone");+ assert_eq!((selected(s), editable(s)), (pasted.clone(), true), "the batch undone");// Isolation mode inside a batch protects it before the next step.let isolated = json!({"commands": [{"command": "object.isolate", "params": {"id": pasted[0]}}, up]});let r = s.execute("command.batch", &isolated).unwrap();@@ -681,21 +688,21 @@ fn new_art_on_a_locked_artboard_stays_editable_until_the_selection_leaves_it() {s.execute("object.exitIsolation", &json!({})).unwrap();// Isolation mode starts with nothing selected, so leaving it doesn't select the art again,// and the art, protected again, isn't isolated, as locked art isn't.- assert!(selected(&s).is_empty(), "after isolation mode");- assert!(!editable(&s), "after isolation mode");+ assert!(selected(s).is_empty(), "after isolation mode");+ assert!(!editable(s), "after isolation mode");assert!(s.execute("object.isolate", &json!({"id": pasted[0]})).is_err(), "isolating it again");// A member of a new group can be selected while the group is new art.let copy = ids(&s.execute("edit.paste", &json!({"center": [1200, 150]})).unwrap()["ids"]);s.execute("object.group", &json!({})).unwrap();- let group = selected(&s);+ let group = selected(s);s.execute("select.set", &json!({"ids": copy})).unwrap();- assert_eq!(selected(&s), copy, "a member of a new group");+ assert_eq!(selected(s), copy, "a member of a new group");s.execute("select.set", &json!({"ids": group})).unwrap();- assert_eq!(selected(&s), group, "from the member back to the group");+ assert_eq!(selected(s), group, "from the member back to the group");s.execute("object.ungroup", &json!({})).unwrap();- assert_eq!(selected(&s), copy, "ungrouped");+ assert_eq!(selected(s), copy, "ungrouped");s.execute("object.move", &json!({"dx": 10, "dy": 0})).unwrap();- assert_eq!(selected(&s), copy, "the ungrouped art moves");+ assert_eq!(selected(s), copy, "the ungrouped art moves");}/// When an artboard moves, scales or is cut with its art, the art inside it that is also on a