refactor: move resource/IO root modules under io/

Relocate three root-level modules into io/, where they belong by concern:

- update_check.rs -> io/update_check.rs (its own doc-comment notes it
  mirrors how crate::io wraps blocking calls in async).
- patterns.rs, linetypes.rs -> io/ (standard resource catalogs parsed
  from asset files and populated into the document — IO-shaped work).

Fix the moved files' include_str! paths (one level deeper), add the
mod declarations to io/mod.rs, drop them from lib.rs/main.rs, and
re-point all crate:: references to crate::io::. No behavior change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-26 23:06:40 +03:00
1 parent bbdbd0850b
commit 415dbe08d4
15 files changed
+18 -21

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
use crate::command::CadCommand;
use crate::linetypes;
use crate::io::linetypes;
use crate::modules::draw::modify::refedit::RefEditSession;
use crate::scene::pick::grip::GripEdit;
use crate::scene::GripDef;
+1 -1
View File
@@ -60,7 +60,7 @@ impl OpenCADStudio {
} else {
lt.name.clone()
};
let art = crate::linetypes::extract_pattern(&lt.description);
let art = crate::io::linetypes::extract_pattern(&lt.description);
ui::properties::LinetypeItem { name, art }
})
.collect();
+2 -2
View File
@@ -1476,7 +1476,7 @@ pub enum Message {
Noop,
/// GitHub releases API returned a result. `Some(version)` means a
/// newer release exists; we open the update-notice window.
UpdateCheckResult(Option<crate::update_check::UpdateInfo>),
UpdateCheckResult(Option<crate::io::update_check::UpdateInfo>),
/// User dismissed the update-notice window.
UpdateNoticeClose,
/// First-launch default-association prompt: user accepted — register this
@@ -2072,7 +2072,7 @@ impl OpenCADStudio {
s.main_window = Some(id);
let open_main = open_task.map(|_| Message::Noop);
let check_update = Task::perform(
crate::update_check::check_for_update(),
crate::io::update_check::check_for_update(),
Message::UpdateCheckResult,
);
let focus_cmd = s.focus_cmd_input();
+1 -1
View File
@@ -1,6 +1,6 @@
use super::helpers::{entity_type_key, entity_type_label, title_case_word};
use super::{OpenCADStudio, VARIES_LABEL};
use crate::linetypes;
use crate::io::linetypes;
use crate::scene::view::dispatch;
use crate::ui;
use acadrust::{EntityType, Handle};
+1 -1
View File
@@ -341,7 +341,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
self.tabs[i].scene.selected = rustc_hash::FxHashSet::default();
self.tabs[i].scene.preview_wires = vec![];
self.tabs[i].scene.current_layout = "Model".to_string();
crate::linetypes::populate_document(&mut self.tabs[i].scene.document);
crate::io::linetypes::populate_document(&mut self.tabs[i].scene.document);
self.tabs[i].properties = PropertiesPanel::empty();
// Seed the current table / multileader style from the file's
// header so the ✓ marks the right one (text/dim/mline come from
+2 -2
View File
@@ -537,7 +537,7 @@ impl OpenCADStudio {
let i = self.active_tab;
self.push_undo_snapshot(i, "CLEAR");
self.tabs[i].scene.clear();
crate::linetypes::populate_document(&mut self.tabs[i].scene.document);
crate::io::linetypes::populate_document(&mut self.tabs[i].scene.document);
self.tabs[i].properties = PropertiesPanel::empty();
let doc_layers = self.tabs[i].scene.document.layers.clone();
let vp_info = self.tabs[i].scene.viewport_list();
@@ -2449,7 +2449,7 @@ impl OpenCADStudio {
Task::none()
}
Message::UpdateNoticeOpenRelease => {
crate::sys::open_url(crate::update_check::RELEASES_PAGE);
crate::sys::open_url(crate::io::update_check::RELEASES_PAGE);
self.close_active_modal();
Task::none()
}
+1 -1
View File
@@ -69,7 +69,7 @@ pub fn complex_lt(name: &str) -> Option<&'static ComplexLt> {
.get(&name.to_ascii_uppercase())
}
const LIN_SOURCE: &str = include_str!("../assets/linetypes/OpenCADStudio.lin");
const LIN_SOURCE: &str = include_str!("../../assets/linetypes/OpenCADStudio.lin");
// ── Pattern art extraction ────────────────────────────────────────────────
+4 -1
View File
@@ -11,6 +11,9 @@ pub mod print_to_printer;
pub mod step;
pub mod stl;
pub mod xref;
pub mod linetypes;
pub mod patterns;
pub mod update_check;
use crate::scene::DerivedCaches;
use acadrust::entities::{Dimension, EntityType};
@@ -879,7 +882,7 @@ mod layer_roundtrip_tests {
// round-trip through `ext`, and return whether every one survived.
fn roundtrip_layers(ext: &str, count: usize) -> bool {
let mut doc = CadDocument::new();
crate::linetypes::populate_document(&mut doc);
crate::io::linetypes::populate_document(&mut doc);
let names: Vec<String> = (0..count).map(|n| format!("Layer{}", n + 1)).collect();
for name in &names {
let mut dl = DocLayer::new(name);
+1 -1
View File
@@ -8,7 +8,7 @@
use std::sync::OnceLock;
const PAT_SRC: &str = include_str!("../assets/patterns/OpenCADStudio.pat");
const PAT_SRC: &str = include_str!("../../assets/patterns/OpenCADStudio.pat");
// ── Public types ──────────────────────────────────────────────────────────
File renamed without changes.
-3
View File
@@ -6,13 +6,10 @@ pub mod cli;
pub mod command;
pub mod entities;
pub mod io;
pub mod linetypes;
pub mod modules;
pub mod plugin;
pub mod patterns;
pub mod scene;
pub mod snap;
pub mod ui;
pub mod par;
pub mod sys;
pub mod update_check;
-3
View File
@@ -10,16 +10,13 @@ mod cli;
mod command;
mod entities;
mod io;
mod linetypes;
mod modules;
mod plugin;
mod patterns;
mod scene;
mod snap;
mod ui;
mod par;
mod sys;
mod update_check;
fn main() -> iced::Result {
// Web (wasm) uses the single-window entry; native uses the multi-window
+2 -2
View File
@@ -6,7 +6,7 @@
use std::sync::OnceLock;
use crate::patterns::PatLineDef;
use crate::io::patterns::PatLineDef;
use crate::scene::model::hatch_model::{HatchPattern, PatFamily};
use acadrust::entities::{HatchPattern as DxfPattern, HatchPatternLine};
use acadrust::types::Vector2;
@@ -65,7 +65,7 @@ fn build_catalog() -> Vec<PatternEntry> {
pat_lines: vec![],
}];
for def in crate::patterns::catalog() {
for def in crate::io::patterns::catalog() {
entries.push(PatternEntry {
name: def.name.clone(),
description: def.description.clone(),
+1 -1
View File
@@ -665,7 +665,7 @@ pub(crate) fn tessellate_entity(
// linetype assigned, so we only consult the first wire here — multi-wire
// returns come exclusively from MTEXT colour splits which can't trigger
// this path.
if let Some(clt) = crate::linetypes::complex_lt(lt_name) {
if let Some(clt) = crate::io::linetypes::complex_lt(lt_name) {
if let Some(base) = bases.first() {
let mut wires = text::complex_lt::apply_along(
&base.name,
+1 -1
View File
@@ -7,7 +7,7 @@
//! Shape X → along the linetype direction; Shape Y → perpendicular in XZ.
use crate::entities::text_support::resolve_dxf_special_chars;
use crate::linetypes::{ComplexLt, LtSegment};
use crate::io::linetypes::{ComplexLt, LtSegment};
use crate::scene::text::lff;
use crate::scene::model::wire_model::WireModel;