Skip to content
Merged
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion apps/draftcraft/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ fn services() -> Services {
/// filter's extension, and macOS accepts only listed extensions, replacing any other with the
/// first one. DWG must be listed for a `.dwg` name to survive, and a drawing opened from DWG
/// then defaults to DWG; other names keep DXF first.
fn filters_for_save(name: &str) -> [(&'static str, &'static str); 8] {
fn filters_for_save(name: &str) -> [(&'static str, &'static str); 9] {
let mut filters = [
("Drawing (DXF)", "dxf"),
("Drawing (DWG)", "dwg"),
Expand All @@ -210,6 +210,8 @@ fn filters_for_save(name: &str) -> [(&'static str, &'static str); 8] {
("PDF", "pdf"),
("Sheet Set (DCSS)", "dcss"),
("ZIP archive", "zip"),
// ATTOUT's attribute values.
("Text, tab-delimited (TXT)", "txt"),
];
let lower = name.to_ascii_lowercase();
filters.sort_by_key(|(_, ext)| !lower.ends_with(&format!(".{ext}")));
Expand Down Expand Up @@ -524,6 +526,7 @@ mod tests {
assert_eq!(first("plan.pdf"), "pdf");
assert_eq!(first("office.dwt"), "dwt");
assert_eq!(first("Project.dcss"), "dcss");
assert_eq!(first("Floorplan.txt"), "txt");
for name in ["a.dwg", "b.dxf", "c"] {
let exts: Vec<_> = filters_for_save(name).iter().map(|(_, e)| *e).collect();
assert!(exts.contains(&"dwg") && exts.contains(&"dxf"), "{name}");
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ draftcraft-doc = { workspace = true }
draftcraft-dxf = { workspace = true }
draftcraft-constraints = { workspace = true }
draftcraft-fonts = { workspace = true }
# ATTIN reads files saved as UTF-16 or Windows-1252 text.
encoding_rs = { workspace = true }
draftcraft-render = { workspace = true }
craft-docpath = { workspace = true }
serde = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/src/cmd/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{Accept, EngineError, Input, Interactive, Prompt, Result, Session, St

mod attdef;
mod attedit;
mod attio;
mod burst;
mod description;
mod dyngrip;
Expand Down Expand Up @@ -89,6 +90,8 @@ pub fn specs() -> Vec<CommandSpec> {
blockreplace::blockreplace_spec(),
extract::dataextraction_spec(),
extract::eattext_spec(),
attio::attout_spec(),
attio::attin_spec(),
description::description_spec(),
]
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/cmd/blocks/attedit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn edit(s: &mut Session, (h, k): (Handle, usize), f: impl FnOnce(&str) -> Option
/// Refresh the derived baseline after a value change, even one within the writer's
/// imported-font tolerance. Equal XY points request recomputation on export; retain
/// both elevations and the independent endpoints used by Aligned/Fit text.
fn set_value(text: &mut Text, value: String) {
pub(super) fn set_value(text: &mut Text, value: String) {
if text.value == value {
return;
}
Expand Down
Loading
Loading