Skip to main content

blockworx_tools/
lib.rs

1//! The tools: one per gesture the canvas offers, plus the vocabulary that
2//! drives them.
3//!
4//! A tool is a per-frame function from state, interaction and document to
5//! preview paints and an optional [`tool::Transition`] — see [`tool::frame`], which
6//! is the only door the drivers use. Around them: the [`commands`] registry
7//! (what can be invoked right now, and the chords that invoke it), the
8//! [`history`] stack a press of undo walks, and the [`spotlight`] ring that
9//! points at what a step changed.
10//!
11//! Nothing here names a UI toolkit. Drawing goes through
12//! [`blockworx_paint::Renderer`], interaction arrives as
13//! [`blockworx_paint::Interaction`], and the on-screen conveniences — the
14//! cursor, the clock, the in-place editor, a repaint — are
15//! [`blockworx_paint::Canvas`].
16
17// The grid is the world-space metric, so it lives with the geometry; every
18// caller reaches it as `crate::grid`, the way the app does.
19pub(crate) use blockworx_geom::grid;
20// The theme is the paint vocabulary's own semantic layer (roles, fonts, the
21// `Style` adapter), reached as `crate::theme` the same way.
22pub(crate) use blockworx_paint::theme;
23// Document editing: the `Drawing` waist, the op emitters, the shapes and the
24// render path. Each is reached as `crate::<name>`, unmoved.
25pub(crate) use blockworx_editor::{edit, path, presentation, render, shape, state, widget};
26
27#[cfg(test)]
28mod authoring_tests;
29pub mod commands;
30#[cfg(test)]
31mod drag_abort_tests;
32#[cfg(test)]
33pub(crate) mod headless;
34pub mod history;
35#[cfg(test)]
36mod label_audit_tests;
37#[cfg(test)]
38mod lazy_edge_drag;
39#[cfg(test)]
40mod read_only_tests;
41pub mod spotlight;
42pub mod tool;
43
44// Three pieces of tool vocabulary that hold no toolkit and no tool state:
45// `ToolName` (whose verbs the editor's undo labels read), the title block's
46// fields, and the breadcrumb a content path spells. They live in the editor
47// crate and are reached here unchanged.
48pub use blockworx_editor::{content_path, names, title_block};
49
50/// What a dialog picks and where a save goes — the shell-typed payloads
51/// [`tool::Action`] carries. What a *path* means is one crate down, in
52/// [`blockworx_store::file`]; opening the dialog is one crate up, in the shell.
53pub mod file;
54
55pub mod add_pin;
56pub mod add_port;
57pub mod add_route_label;
58pub mod add_text;
59pub mod block_edit;
60pub mod edit_route;
61pub mod edit_text_box;
62pub mod move_block;
63pub mod move_block_type;
64pub mod move_label;
65pub mod move_multi_pin;
66pub mod move_pin;
67pub mod move_title;
68pub mod multi_pin_select;
69pub mod multi_select;
70pub mod new_area;
71pub mod new_block;
72pub mod new_pin;
73pub mod rename_block_type;
74pub mod rename_pin;
75pub mod rename_route;
76pub mod rename_title;
77pub mod resize_block;
78pub mod retype_pin;
79pub mod route_start;
80pub mod route_tool;
81pub mod select_pin;
82pub mod select_tool;
83pub mod selection_bounds;
84pub mod stamp;
85
86pub use add_pin::AddPin;
87pub use add_port::AddPort;
88pub use add_route_label::AddRouteLabel;
89pub use add_text::AddText;
90pub use edit_route::EditRoute;
91pub use edit_text_box::EditTextBox;
92pub use move_block::MoveBlock;
93pub use move_block_type::MoveBlockType;
94pub use move_label::MoveLabel;
95pub use move_multi_pin::MoveMultiPin;
96pub use move_pin::MovePin;
97pub use move_title::MoveTitle;
98pub use multi_pin_select::MultiPinSelect;
99pub use multi_select::MultiSelect;
100pub use new_area::NewArea;
101pub use new_block::NewBlock;
102pub use rename_block_type::RenameBlockType;
103pub use rename_pin::RenamePin;
104pub use rename_route::RenameRoute;
105pub use rename_title::RenameTitle;
106pub use retype_pin::RetypePin;
107pub use route_tool::RouteTool;
108pub use select_tool::SelectTool;