Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/doc/src/drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ use solidcraft_geom::Aabb2;
use solidcraft_geom::cell::Projection;
use solidcraft_geom::drawing_sheet::{self, DrawingBorderProfile};
use solidcraft_geom::paper::line::LineGroup;
use solidcraft_geom::revision::RevisionRecord;
use solidcraft_geom::title_block::{TitleBlock, TitleBlockLayout};

use crate::format::{CheckNumbers as _, DRAWING};
Expand All @@ -87,10 +86,12 @@ pub mod measure;
mod newer;
pub mod note;
pub mod projection_symbol;
pub mod revision;
pub mod sheet_set;
mod sketch;
pub mod symbol;
pub mod table;
pub mod table_layout;
pub mod template;
pub mod thread_lines;
pub mod view;
Expand All @@ -109,6 +110,7 @@ use centre_mark::CentreMark;
use dimension::Dimension;
use image::{ImageFile, SheetImage};
use note::{Anchor, Note};
use revision::RevisionRecord;
use symbol::Symbol;
use table::SheetTable;
use view::{View, ViewLetters};
Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/balloon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ use serde::{Deserialize, Serialize};
use solidcore_record::Vec3;
use solidcraft_geom::drawing_view::is_paper_coordinate;
use solidcraft_geom::paper::MAX_SIDE_MM;
use solidcraft_geom::table::Ballooned;

use super::by_id::Record;
use super::dimension::{Lookup, ModelEdge, Status, check_edge};
use super::table::{Kind, PartsList, SheetTable};
use super::table_layout::Ballooned;
use super::{Drawing, require};
use crate::bom::{self, Bom, Tree, Unlisted, item_text};
use crate::{DocError, Document, Model, ModelState, Result, ids};
Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/balloon_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn a_balloon_reads_the_list_it_names_else_the_only_one() {
/// balloons read counts only those on its sheet.
#[test]
fn a_list_counts_only_the_balloons_that_read_it() {
use solidcraft_geom::table::Ballooned;
use crate::drawing::table_layout::Ballooned;
let (mut d, [one, two]) = ballooned();
let sheet = d.sheets[0].id;
let other = 1 << 40;
Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
//! - **prompt:** any key; answers come with templates, so a prompt shows [`MISSING`] until then.

use solidcraft_geom::cell::{Content, MISSING, Part, Source};
use solidcraft_geom::revision::{Field, RevisionRow};
use solidcraft_geom::title_block::{CellKind, TitleBlock};

use super::Drawing;
use super::revision::{Field, RevisionRow};
use crate::display_units::format_length;
use crate::{ComponentNameSplit, DocError, Metadata, Result};

Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/newer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::sync::Arc;

use serde::{Deserialize, Serialize};
use serde_json::{Value, value::RawValue};
use solidcraft_geom::revision::{self, RevisionRow, Tag};

use super::image::{self, ImageFile, SheetImage};
use super::revision::{self, RevisionRow, Tag};
use super::table::{Kind, SheetTable};
use super::view::{View, ViewKind};
use super::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A drawing's revisions: the revision record, its numbering, its issued history and its tags, as
//! data. The revision table shows the record through the sheet table ([`crate::table`]), and a
//! title block's revision fields ([`crate::cell::Source::Revision`]) read its newest row through the
//! data. The revision table shows the record through the sheet table ([`super::table_layout`]), and a
//! title block's revision fields ([`solidcraft_geom::cell::Source::Revision`]) read its newest row through the
//! same [`RevisionRow::field`].
//!
//! - One record covers the whole drawing, or each sheet on its own (`per_sheet`), numbered apart.
Expand All @@ -24,10 +24,10 @@
use std::collections::{BTreeSet, HashSet};

use serde::{Deserialize, Serialize};
use solidcraft_geom::cell::{self, Content, HAlign, Part, Source, check_label, check_text};
use solidcraft_geom::drawing_view::is_paper_coordinate;

use crate::cell::{self, Content, HAlign, Part, Source, check_label, check_text};
use crate::drawing_view::is_paper_coordinate;
use crate::table::{self, Column, Heading, RowKind, Table};
use super::table_layout::{self as table, Column, Heading, RowKind, Table};

/// The most rows a record may have.
pub const MAX_ROWS: usize = 1000;
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct RevisionRow {
#[serde(with = "crate::ids")]
pub id: u64,
/// Its sheet in a record kept per sheet (opaque here), else none.
#[serde(default, with = "crate::ids::option")]
#[serde(default, with = "solidcraft_geom::ids::option")]
pub sheet: Option<u64>,
pub revision: String,
#[serde(default)]
Expand Down
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use serde::{Deserialize, Serialize};
use solidcraft_geom::cell::{Content, Format, HAlign, Part, Source};
use solidcraft_geom::drawing_view::is_paper_coordinate;
use solidcraft_geom::paper::MAX_SIDE_MM;
use solidcraft_geom::table::{self, BALLOONED, Column, Filter, Heading, Table};

use super::by_id::Record;
use super::table_layout::{self as table, BALLOONED, Column, Filter, Heading, Table};
use super::{Drawing, SheetComponent, require};
use crate::assembly::BomType;
use crate::bom::{self, Bom, Group, Mass, Quantity, Request, View};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! A [`Table`] is a definition: its columns, the side its heading is on, its row height, its text
//! height, its two line widths, a filter and overrides. A [`Column`]'s cells are cell content
//! ([`crate::cell`]) read against the row each is on: row fields and text. The rows are input
//! ([`solidcraft_geom::cell`]) read against the row each is on: row fields and text. The rows are input
//! ([`Row`]), in the order they are listed (a bill of materials' item order), with their values
//! worked out and formatted: nothing here works one out, so a filter hides rows and never changes
//! a count or a quantity. [`Table::validate`] checks a definition on its own, as when one is read,
Expand All @@ -27,18 +27,18 @@ use std::collections::{BTreeMap, HashMap, HashSet};

use serde::{Deserialize, Serialize};

use crate::Aabb2;
use crate::cell::{self, Content, HAlign, PADDING_MM, Part, Source, Warning, check_text, is_snake_case};
use crate::paper::{Group, Item, MAX_COORDINATE_MM, MAX_LINE_MM, MAX_SIDE_MM, ObjectKind};
use solidcore_record::{Loop2, Seg2, Vec2};
use solidcraft_geom::Aabb2;
use solidcraft_geom::cell::{self, Content, HAlign, PADDING_MM, Part, Source, Warning, check_text, is_snake_case};
use solidcraft_geom::paper::{Group, Item, MAX_COORDINATE_MM, MAX_LINE_MM, MAX_SIDE_MM, ObjectKind};

/// The most rows a table may list, and the most overrides it may keep.
pub const MAX_ROWS: usize = 10_000;
/// The most columns a table may have.
pub const MAX_COLUMNS: usize = 64;
/// The most bytes of text a table and its rows may hold in all.
pub const MAX_TEXT_BYTES: usize = 1 << 20;
use crate::cell::MISSING;
use solidcraft_geom::cell::MISSING;
/// The distance between baselines, in cap heights: ISO 3098-0's line spacing.
pub const LINE_PITCH: f64 = 10.0 / 7.0;
/// The longest row field key or field.
Expand Down Expand Up @@ -530,5 +530,5 @@ fn wrap(text: &str, room: f64, width: &dyn Fn(&str) -> Result<f64>) -> Result<(V
}

#[cfg(test)]
#[path = "table_tests.rs"]
#[path = "table_layout_tests.rs"]
mod tests;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::prelude::*;
use serde_json::json;
use solidcraft_geom::cell::Format;
use solidcraft_geom::prelude::*;

use super::*;
use crate::cell::Format;

/// Every character 0.6 cap heights wide: 1.5 mm at the tests' 2.5 mm text.
fn fixed(text: &str, cap_mm: f64) -> f64 {
Expand Down Expand Up @@ -535,6 +535,6 @@ fn a_table_at_its_limits_is_a_valid_paper_group() {
}

/// An A3 landscape sheet with these groups.
fn sheet(groups: Vec<Group>) -> crate::paper::Scene {
crate::paper::Scene::new(Vec2::new(420.0, 297.0), groups)
fn sheet(groups: Vec<Group>) -> solidcraft_geom::paper::Scene {
solidcraft_geom::paper::Scene::new(Vec2::new(420.0, 297.0), groups)
}
2 changes: 1 addition & 1 deletion crates/doc/src/drawing/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ use std::sync::Arc;

use solidcraft_geom::cell::Part;
use solidcraft_geom::drawing_sheet::{self, DrawingBorderProfile, Orientation, PaperSize};
use solidcraft_geom::revision::RevisionRecord;
use solidcraft_geom::title_block::{self, CellKind, TitleBlock};

use super::Drawing;
use super::image::ImageFile;
use super::revision::RevisionRecord;
use crate::format::DRAWING;
use crate::ids::{self, IdSource};
use crate::{DocError, Document, Result};
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/drawing_balloon_tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use serde_json::json;
use solidcraft_doc::drawing::table_layout::BALLOONED;
use solidcraft_doc::drawing::view::{View, ViewKind, ViewPlace};
use solidcraft_doc::drawing_view::{ViewDirection, ViewOverrides};
use solidcraft_geom::drawing_view::NamedView;
use solidcraft_geom::table::BALLOONED;
use solidcraft_sketch::PaperFonts;

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/src/cmd/drawing_revision.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A drawing's revision rows (#3874, W31): add, edit and delete them, each one undo step of the
//! drawing (none when nothing changes); `drawing.inspect` lists them. One revision record covers the whole drawing
//! ([`solidcraft_geom::revision`]): a new row gets the next revision, after the highest the record
//! ([`solidcraft_doc::drawing::revision`]): a new row gets the next revision, after the highest the record
//! has given, and people type the rest. The newest row is the drawing's revision, hidden or not.
//!
//! `drawing.revise` (#3874 R1) issues a revision: it appends a copy of a row to the issued history
Expand All @@ -10,8 +10,8 @@
use std::sync::Arc;

use serde_json::Value;
use solidcraft_doc::drawing::revision::{Field, ModelVersion, RevisionRecord, RevisionRow, Tag};
use solidcraft_doc::ids;
use solidcraft_geom::revision::{Field, ModelVersion, RevisionRecord, RevisionRow, Tag};

use super::CommandSpec;
use crate::params::bad;
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/drawing_revision_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn hostile_revision_calls_are_refused() {
refused(&mut s, cmd, p);
}
// A record holds at most 1000 rows.
for _ in 1..solidcraft_geom::revision::MAX_ROWS {
for _ in 1..solidcraft_doc::drawing::revision::MAX_ROWS {
add(&mut s, json!({}));
}
assert!(refused(&mut s, ADD, json!({})).contains("at most 1000 rows"));
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/drawing_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use std::sync::Arc;

use serde_json::Value;
use solidcraft_doc::drawing::table::{Kind, MassFormat, PartsList, SheetTable};
use solidcraft_doc::drawing::table_layout::BALLOONED;
use solidcraft_doc::drawing::{Drawing, OnSheet, SheetComponent};
use solidcraft_doc::ids;
use solidcraft_geom::Aabb2;
use solidcraft_geom::cell::Warning;
use solidcraft_geom::table::BALLOONED;
use solidcraft_sketch::PaperFonts;

use super::CommandSpec;
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/drawing_revision_paper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//! A tag reads no model: the sheet sets it with its own notes, in paper coordinates.

use solidcore_record::{Seg2, Vec2};
use solidcraft_doc::drawing::revision::{RevisionRecord, Tag, TagText};
use solidcraft_geom::paper::{Group, Item, ObjectKind};
use solidcraft_geom::revision::{RevisionRecord, Tag, TagText};
use solidcraft_sketch::{PaperFonts, TextStyle};

use crate::drawing_dimension_paper::{GAP_MM, Layout, OnPaper, TEXT_MM, Text, placed, text_box};
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/drawing_table_paper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ use solidcore_record::Vec2;
use solidcraft_doc::bom::{self, Tree};
use solidcraft_doc::drawing::balloon::balloons_by_row;
use solidcraft_doc::drawing::table::{Corner, Kind, Place, SheetTable};
use solidcraft_doc::drawing::table_layout::{BALLOONED, Heading, Row, Table, TableLayout};
use solidcraft_doc::drawing::{Drawing, Sheet};
use solidcraft_geom::Aabb2;
use solidcraft_geom::cell::{HAlign, Part};
use solidcraft_geom::paper::text::Font;
use solidcraft_geom::paper::{Group, Item, ObjectKind};
use solidcraft_geom::table::{BALLOONED, Heading, Row, Table, TableLayout};
use solidcraft_sketch::{Outcome, PaperFonts, PaperLines, TextStyle};

use crate::Session;
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/drawing_table_paper_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use solidcraft_doc::drawing::SheetComponent;
use solidcraft_doc::drawing::table::PartsList;
use solidcraft_doc::drawing::table_layout::Heading;
use solidcraft_geom::cell::Content;
use solidcraft_geom::table::Heading;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ impl Session {

/// The open design's version, for an issued revision to name: nothing in the browser, for an
/// unsaved design, and until version control gives versions (#2869), which fills this in.
pub(crate) fn design_version(&self) -> Option<solidcraft_geom::revision::ModelVersion> {
pub(crate) fn design_version(&self) -> Option<solidcraft_doc::drawing::revision::ModelVersion> {
None
}

Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/schema/drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use schemars::{JsonSchema, Schema, SchemaGenerator, json_schema};
use serde::de::Error as _;
use serde::{Deserialize, Deserializer, Serialize};
use serde_json::Value;
use solidcraft_doc::drawing::revision::Numbering;
use solidcraft_doc::drawing::{Units, Updates};
use solidcraft_geom::cell::Projection;
use solidcraft_geom::revision::Numbering;

use super::check::whole;
use super::drawing_view::{LineGroupParam, SheetParam};
Expand Down
2 changes: 1 addition & 1 deletion crates/geom/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn require(condition: bool, message: &'static str) -> Result<()> {

/// A lowercase letter, then lowercase letters, digits and underscores: at most 64 in all. Cells and
/// columns are named by it.
pub(crate) fn is_snake_case(name: &str) -> bool {
pub fn is_snake_case(name: &str) -> bool {
let mut bytes = name.bytes();
name.len() <= MAX_NAME_BYTES
&& bytes.next().is_some_and(|b| b.is_ascii_lowercase())
Expand Down
2 changes: 0 additions & 2 deletions crates/geom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ pub mod pixel_grid;
pub mod plain_text;
mod plane;
mod profile;
pub mod revision;
pub mod section;
pub mod simplify;
pub mod spline_space;
pub mod stderr;
pub mod surface_texture;
pub mod table;
/// The plan evaluator and the display plan, solidcore-tess's (RFC 0003, items 1.1 and 1.8;
/// `solidcore_tess::eval`), under their old path.
pub mod tess {
Expand Down
2 changes: 1 addition & 1 deletion crates/ui-egui/src/drawing_workspace/panels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use solidcraft_engine::doc::drawing::{
Drawing, MAX_DPI, MAX_NAME_BYTES, MIN_DPI, Sheet,
dimension::DimensionKind,
table::{Kind, MassFormat, PartsList},
table_layout::Heading,
};
use solidcraft_engine::doc::ids;
use solidcraft_engine::geom::{
drawing_sheet::{DrawingBorderProfile, Orientation, PaperSize, Sheet as Paper, SheetSize},
drawing_view::Scale,
table::Heading,
title_block::{self, TitleBlock},
};
use solidcraft_engine::render::VisualStyle;
Expand Down