fix(units): make the units selector reach what it names

The status-bar units button wrote INSUNITS, which nothing on screen reads.
INSUNITS only tells the drawing how to scale content arriving from
elsewhere, so picking a unit relabelled the drawing and changed nothing
visible — the selector looked broken because the variable it moved was
invisible.

Point the button at LUNITS instead, the setting that decides how every
coordinate and distance is written, and give the three questions the word
"units" runs together a place each:

- The button offers the five length formats, each shown beside a sample of
  itself, so Engineering and Architectural are told apart by sight.
- UNITS / DDUNITS opens a real dialog: length and angle format and
  precision, the direction angle zero points, whether positive angles run
  clockwise, and the insertion unit. Its sample comes from the same
  formatters the drawing uses, so it cannot drift from the readout.
- DWGUNITS converts. Model geometry, viewport framing, the header's length
  defaults and each dimension style's scale all move together in one undo
  step; paper space is left alone, since the sheet is still the same sheet.
  Locked layers are converted too — a half-converted drawing would be at
  two scales at once.

The coordinate readout formatted at four decimal places whatever the
drawing asked for; it now goes through the same format_length the
properties panel uses. That made the angle formats reachable in turn, so
degrees-minutes-seconds now carries the d/'/" marks that say which
convention it is, and surveyor's units are written at all.

Typed input is still plain decimal: a length the readout writes as
5'-6 1/2" cannot yet be typed back. ANGBASE and ANGDIR are stored but not
yet applied to displayed directions.

Closes #668

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5 committed 2026-08-07 19:59:09 +03:00
1 parent cfc7c06c6c
commit 523b85f42b
14 files changed
+937 -69

No files matched your search

+14 -1
View File
@@ -1658,6 +1658,19 @@ impl OpenCADStudio {
let active_block = tab
.active_block_edit_session()
.map(|session| session.block_name.clone());
// The coordinate readout formats through the same helper
// the properties panel uses, so it has to see the drawing's
// linear-unit settings. Properties happens to set this on
// every refresh; the status bar redraws on its own schedule
// and cannot rely on that having happened.
crate::entities::common::set_unit_context(
crate::entities::common::UnitContext {
lunits: tab.scene.document.header.linear_unit_format,
luprec: tab.scene.document.header.linear_unit_precision,
aunits: tab.scene.document.header.angular_unit_format,
auprec: tab.scene.document.header.angular_unit_precision,
},
);
let status_menu_data = crate::ui::statusbar::StatusMenuData {
layout_names: layout_names.clone(),
polar_custom_input: &self.polar_custom_input,
@@ -1703,7 +1716,7 @@ impl OpenCADStudio {
last_coord,
picking,
self.clean_screen,
tab.scene.document.header.insertion_units,
tab.scene.document.header.linear_unit_format,
tab.scene.is_isolation_active(),
tab.scene.transparency_display,
self.quick_properties,
+7
View File
@@ -20,6 +20,7 @@ impl OpenCADStudio {
Some(K::Layers) => crate::tr!("modal-layer-manager"),
Some(K::LayerStateManager) => crate::tr!("modal-layer-state-manager"),
Some(K::LayerTranslator) => crate::t!("Layer Translator").into_owned(),
Some(K::DrawingUnits) => crate::t!("Drawing Units").into_owned(),
Some(K::LayerStateEditor) => crate::tr!("modal-edit-layer-state"),
Some(K::Plot) => crate::tr!("modal-plot"),
Some(K::PrintAll) => t!("Print All").into_owned(),
@@ -185,6 +186,12 @@ impl OpenCADStudio {
)
})
}
super::super::ModalKind::DrawingUnits => {
let state = self.drawing_units.as_ref()?;
sized_flow(ex, 560, 420, |flow| {
crate::ui::window::drawing_units::view_window(state, flow)
})
}
super::super::ModalKind::LayerStateManager => {
let states = self.tabs[self.active_tab].scene.document.layer_states();
sized_flow(