forked from 1b-agent/opencadstudio-upstream
Count: Invalid Area dialog, table block kept with the table
- When the count area's boundary is gone the approved Invalid Area dialog asks: undo the change (also its X and Cancel) or count all of model space; "always" keeps the choice in the settings. An edited boundary moves the area. - A table's *T block is brought up to date whenever the table changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4dba66bbac
commit
7ad6e5b094
33 files changed
+318
-5
No files matched your search
Generated
+1
-1
@@ -4206,7 +4206,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "opencadcodec"
|
||||
version = "0.5.5"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=483c006#483c006df06edeb371af25a39f975007dd91f8ca"
|
||||
source = "git+https://github.com/ramox81/cadcodec.git?rev=115b753#115b7536c7c00bdd9684a80f2bb7642c11b048e9"
|
||||
dependencies = [
|
||||
"ahash 0.8.12",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ block2 = "0.5"
|
||||
objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString", "NSObject", "NSNotification", "NSThread", "NSEnumerator"] }
|
||||
|
||||
[patch."https://github.com/HakanSeven12/opencadcodec.git"]
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "483c006" }
|
||||
opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "115b753" }
|
||||
|
||||
[patch.crates-io]
|
||||
iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" }
|
||||
|
||||
@@ -5956,3 +5956,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5944,3 +5944,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5941,3 +5941,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5942,3 +5942,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5944,3 +5944,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5945,3 +5945,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5944,3 +5944,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5941,3 +5941,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5943,3 +5943,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5932,3 +5932,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5943,3 +5943,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5943,3 +5943,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5932,3 +5932,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5943,3 +5943,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5942,3 +5942,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5943,3 +5943,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5944,3 +5944,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5945,3 +5945,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5867,3 +5867,10 @@ count-feature =
|
||||
.overlap = Üst üste binen nesne
|
||||
.show-instances = Örnekleri göster
|
||||
.geometries = Geometriler: __ocs_fmt_0__
|
||||
.invalid-title = Sayım - Geçersiz Alan
|
||||
.invalid-message = Sayım sınırındaki değişiklikler geçersiz bir sayım alanıyla sonuçlandı. Ne yapmak istersiniz?
|
||||
.invalid-undo = Sayım sınırındaki değişiklikleri geri al
|
||||
.invalid-undo-detail = Son işlem geri alınır, sınır ve sayım alanı eski haline döner.
|
||||
.invalid-continue = Devam et ve tüm model alanını say
|
||||
.invalid-continue-detail = Sayım alanı kalkar; sayım tüm model alanında sürer.
|
||||
.invalid-always = Geçerli seçimimi her zaman uygula
|
||||
@@ -5927,3 +5927,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -5939,3 +5939,10 @@ count-feature =
|
||||
.overlap = Overlapping object
|
||||
.show-instances = Show Count Instances
|
||||
.geometries = Geometries: __ocs_fmt_0__
|
||||
.invalid-title = Count - Invalid Area
|
||||
.invalid-message = The changes to count boundary have resulted to an invalid count area. What do you want to do?
|
||||
.invalid-undo = Undo the changes to the count boundary
|
||||
.invalid-undo-detail = The last change is undone; the boundary and the count area come back.
|
||||
.invalid-continue = Continue and count the entire model space
|
||||
.invalid-continue-detail = The count area is dropped; counting goes on in all of model space.
|
||||
.invalid-always = Always perform my current choice
|
||||
@@ -268,8 +268,63 @@ impl OpenCADStudio {
|
||||
/// After the drawing changes, count mode colours its references again.
|
||||
pub(in crate::app) fn refresh_count_if_stale(&mut self) {
|
||||
let i = self.active_tab;
|
||||
if self.tabs[i].count.as_ref().is_some_and(|m| m.epoch != self.tabs[i].scene.geometry_epoch) {
|
||||
self.apply_count_display(i);
|
||||
let Some(mode) = self.tabs[i].count.as_ref().filter(|m| m.epoch != self.tabs[i].scene.geometry_epoch) else {
|
||||
return;
|
||||
};
|
||||
if let Some((h, _)) = mode.boundary {
|
||||
match self.tabs[i].scene.document.get_entity(h) {
|
||||
// The boundary is gone (erased, undone): ask, or do what was
|
||||
// chosen for good.
|
||||
None => {
|
||||
if self.active_modal == Some(crate::app::ModalKind::CountInvalidArea) {
|
||||
return;
|
||||
}
|
||||
match self.count_palette.invalid_choice {
|
||||
1 => self.count_invalid_undo(i),
|
||||
2 => self.count_invalid_continue(i),
|
||||
_ => {
|
||||
self.count_palette.invalid_always = false;
|
||||
self.active_modal = Some(crate::app::ModalKind::CountInvalidArea);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// An edited boundary moves the area with it.
|
||||
Some(EntityType::LwPolyline(pl)) => {
|
||||
let ring: Vec<[f64; 2]> = pl.vertices.iter().map(|v| [v.location.x, v.location.y]).collect();
|
||||
if let Some(mode) = self.tabs[i].count.as_mut() {
|
||||
mode.area = Some(ring);
|
||||
}
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
}
|
||||
self.apply_count_display(i);
|
||||
}
|
||||
|
||||
/// Invalid Area › Undo (also ✕ and Cancel): the change that took the
|
||||
/// boundary away is undone.
|
||||
fn count_invalid_undo(&mut self, i: usize) {
|
||||
self.undo_active_tab();
|
||||
self.apply_count_display(i);
|
||||
}
|
||||
|
||||
/// Invalid Area › Continue: the area goes, the count covers all of model space.
|
||||
fn count_invalid_continue(&mut self, i: usize) {
|
||||
if let Some(mode) = self.tabs[i].count.as_mut() {
|
||||
mode.area = None;
|
||||
mode.boundary = None;
|
||||
}
|
||||
self.apply_count_display(i);
|
||||
}
|
||||
|
||||
fn close_invalid_area(&mut self, choice: u8) {
|
||||
if self.active_modal == Some(crate::app::ModalKind::CountInvalidArea) {
|
||||
self.close_active_modal();
|
||||
}
|
||||
if self.count_palette.invalid_always {
|
||||
self.count_palette.invalid_choice = choice;
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,6 +810,15 @@ impl OpenCADStudio {
|
||||
return self.start_count_command(i, Box::new(command), "COUNT");
|
||||
}
|
||||
CountMsg::Field => return self.dispatch_command("COUNTFIELD"),
|
||||
CountMsg::InvalidAlways(v) => self.count_palette.invalid_always = v,
|
||||
CountMsg::InvalidUndo => {
|
||||
self.close_invalid_area(1);
|
||||
self.count_invalid_undo(i);
|
||||
}
|
||||
CountMsg::InvalidContinue => {
|
||||
self.close_invalid_area(2);
|
||||
self.count_invalid_continue(i);
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ impl OpenCADStudio {
|
||||
// layer|scale|mirror>:NAME", "create_table", "check=NAME:1",
|
||||
// "all=1", "table_cancel", "table_insert", "back", "match=<0|1|2>:1",
|
||||
// "details", "errors", "error=<n>", "area", "prev", "next", "select",
|
||||
// "field", "close".
|
||||
// "field", "close", "invalid_undo", "invalid_continue", "invalid_always=1".
|
||||
"count_palette" => {
|
||||
use crate::ui::window::count_palette::{CountMsg as M, RowAction};
|
||||
let value = string(req, "value")?;
|
||||
@@ -993,6 +993,10 @@ impl OpenCADStudio {
|
||||
"select" => M::Select,
|
||||
"field" => M::Field,
|
||||
"close" => M::Close,
|
||||
// The Invalid Area dialog.
|
||||
"invalid_undo" => M::InvalidUndo,
|
||||
"invalid_continue" => M::InvalidContinue,
|
||||
"invalid_always" => M::InvalidAlways(arg == "1"),
|
||||
_ => return Err(bad()),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1943,6 +1943,7 @@ pub enum ModalKind {
|
||||
GeometricTolerance,
|
||||
AttDef,
|
||||
AttDefEdit,
|
||||
CountInvalidArea,
|
||||
Field,
|
||||
DraftingSettings,
|
||||
AutoConstrainSettings,
|
||||
|
||||
@@ -622,6 +622,9 @@ pub struct UserSettings {
|
||||
/// COUNTSERVICE (default on).
|
||||
#[serde(default = "default_true")]
|
||||
pub count_service: bool,
|
||||
/// Count - Invalid Area: 0 ask, 1 undo, 2 count all of model space.
|
||||
#[serde(default)]
|
||||
pub count_invalid_area: u8,
|
||||
}
|
||||
|
||||
/// A block the Blocks palette lists from outside the current drawing (a
|
||||
@@ -873,6 +876,7 @@ impl Default for UserSettings {
|
||||
count_color: 3,
|
||||
count_error_color: 1,
|
||||
count_service: true,
|
||||
count_invalid_area: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,6 +748,7 @@ impl OpenCADStudio {
|
||||
count_color: self.count_palette.color,
|
||||
count_error_color: self.count_palette.error_color,
|
||||
count_service: self.count_palette.service,
|
||||
count_invalid_area: self.count_palette.invalid_choice,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,6 +883,7 @@ impl OpenCADStudio {
|
||||
self.count_palette.color = s.count_color;
|
||||
self.count_palette.error_color = s.count_error_color;
|
||||
self.count_palette.service = s.count_service;
|
||||
self.count_palette.invalid_choice = s.count_invalid_area.min(2);
|
||||
self.block_palette.recent = s.block_recent.clone();
|
||||
self.block_palette.favorites = s.block_favorites.clone();
|
||||
self.block_palette.libraries = s.block_libraries.clone();
|
||||
|
||||
@@ -8524,6 +8524,10 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
Message::CloseModal => {
|
||||
// The Invalid Area dialog's ✕ undoes the boundary change, as its Cancel does.
|
||||
if self.active_modal == Some(super::ModalKind::CountInvalidArea) {
|
||||
return self.update(Message::Count(crate::ui::window::count_palette::CountMsg::InvalidUndo));
|
||||
}
|
||||
if self.active_modal == Some(super::ModalKind::Field) {
|
||||
self.close_field_dialog();
|
||||
return Task::none();
|
||||
|
||||
@@ -40,6 +40,7 @@ impl OpenCADStudio {
|
||||
Some(K::GeometricTolerance) => crate::t!("Geometric Tolerance").into_owned(),
|
||||
Some(K::AttDef) => crate::t!("Attribute Definition").into_owned(),
|
||||
Some(K::AttDefEdit) => crate::t!("Edit Attribute Definition").into_owned(),
|
||||
Some(K::CountInvalidArea) => crate::t!("Count - Invalid Area").into_owned(),
|
||||
Some(K::Field) => crate::t!("Field").into_owned(),
|
||||
Some(K::DraftingSettings) => crate::t!("Drafting Settings").into_owned(),
|
||||
Some(K::AutoConstrainSettings) => crate::t!("Constraint Settings").into_owned(),
|
||||
@@ -584,6 +585,9 @@ impl OpenCADStudio {
|
||||
let state = self.field_dialog.as_ref()?;
|
||||
sized_flow(ex, 760, 660, |flow| crate::ui::window::field_dialog::view(state, flow))
|
||||
}
|
||||
super::super::ModalKind::CountInvalidArea => {
|
||||
sized_flow(ex, 520, 260, |flow| crate::ui::window::count_palette::invalid_area_view(&self.count_palette, flow))
|
||||
}
|
||||
super::super::ModalKind::AttDefEdit => {
|
||||
let state = self.attdef_edit.as_ref()?;
|
||||
sized_flow(ex, 460, 220, |flow| crate::ui::window::attdef_dialog::view_edit(state, flow))
|
||||
|
||||
@@ -5546,6 +5546,13 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Overlapping object" => Some(("count-feature", "overlap")),
|
||||
"Show Count Instances" => Some(("count-feature", "show-instances")),
|
||||
"Geometries: {}" => Some(("count-feature", "geometries")),
|
||||
"Count - Invalid Area" => Some(("count-feature", "invalid-title")),
|
||||
"The changes to count boundary have resulted to an invalid count area. What do you want to do?" => Some(("count-feature", "invalid-message")),
|
||||
"Undo the changes to the count boundary" => Some(("count-feature", "invalid-undo")),
|
||||
"The last change is undone; the boundary and the count area come back." => Some(("count-feature", "invalid-undo-detail")),
|
||||
"Continue and count the entire model space" => Some(("count-feature", "invalid-continue")),
|
||||
"The count area is dropped; counting goes on in all of model space." => Some(("count-feature", "invalid-continue-detail")),
|
||||
"Always perform my current choice" => Some(("count-feature", "invalid-always")),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -3468,6 +3468,15 @@ impl Scene {
|
||||
self.associative_hatch_source_cache.borrow_mut().take();
|
||||
}
|
||||
let mut changes = changes.to_vec();
|
||||
// A table's drawing (its *T block) follows the table's cells, sizes
|
||||
// and styles; it is left alone while it already matches.
|
||||
for (handle, kind) in &changes {
|
||||
if !matches!(kind, ChangeKind::Removed)
|
||||
&& matches!(self.document.get_entity(*handle), Some(EntityType::Table(_)))
|
||||
{
|
||||
self.document.refresh_table_block(*handle);
|
||||
}
|
||||
}
|
||||
// A restyle (layer on/off, colour, text or dimension style) moves no
|
||||
// geometry, so nothing measured from it is re-resolved: an
|
||||
// association that disagrees with its dimension would otherwise
|
||||
|
||||
@@ -153,6 +153,11 @@ pub struct CountPalette {
|
||||
pub color: i16,
|
||||
pub error_color: i16,
|
||||
pub service: bool,
|
||||
/// The Invalid Area dialog's "always" box while it is open.
|
||||
pub invalid_always: bool,
|
||||
/// What a lost count boundary does without asking: 0 ask, 1 undo, 2 go
|
||||
/// on with all of model space (kept with the user settings).
|
||||
pub invalid_choice: u8,
|
||||
/// The list's references for (document, geometry epoch, area).
|
||||
pub list_cache: std::cell::RefCell<Option<(usize, u64, Option<Vec<[f64; 2]>>, std::rc::Rc<Vec<BlockInstance>>)>>,
|
||||
}
|
||||
@@ -171,6 +176,8 @@ impl Default for CountPalette {
|
||||
color: 3,
|
||||
error_color: 1,
|
||||
service: true,
|
||||
invalid_always: false,
|
||||
invalid_choice: 0,
|
||||
list_cache: Default::default(),
|
||||
}
|
||||
}
|
||||
@@ -217,6 +224,12 @@ pub enum CountMsg {
|
||||
Select,
|
||||
Field,
|
||||
Close,
|
||||
/// The Invalid Area dialog: undo the boundary change (also its ✕ and
|
||||
/// Cancel), or go on counting all of model space; `InvalidAlways` is its
|
||||
/// "always perform my current choice" box.
|
||||
InvalidUndo,
|
||||
InvalidContinue,
|
||||
InvalidAlways(bool),
|
||||
}
|
||||
|
||||
fn msg(m: CountMsg) -> Message {
|
||||
@@ -609,3 +622,57 @@ pub fn aci_rgba(index: i16) -> [f32; 4] {
|
||||
crate::scene::convert::tess_util::aci_to_rgba(&codec::types::Color::from_index(index))
|
||||
}
|
||||
|
||||
|
||||
/// The Invalid Area dialog, shown when the count area's boundary is gone.
|
||||
pub fn invalid_area_view<'a>(palette: &CountPalette, sizing: crate::ui::modal::ModalSizing) -> Element<'a, Message> {
|
||||
let action = |title: String, detail: String, m: CountMsg| -> Element<'a, Message> {
|
||||
button(
|
||||
row![
|
||||
text("→").size(16).style(|theme: &Theme| text::Style { color: Some(theme.palette().primary.base.color) }),
|
||||
column![text(title).size(13), text(detail).size(11).style(muted_style)].spacing(2),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
.on_press(msg(m))
|
||||
.width(Fill)
|
||||
.padding([10, 12])
|
||||
.style(button_style(false))
|
||||
.into()
|
||||
};
|
||||
column![
|
||||
row![
|
||||
crate::ui::icons::themed_warning(WARNING_ICON, 20.0),
|
||||
text(crate::t!("The changes to count boundary have resulted to an invalid count area. What do you want to do?"))
|
||||
.size(14)
|
||||
.width(Fill),
|
||||
]
|
||||
.spacing(12)
|
||||
.align_y(iced::Center),
|
||||
action(
|
||||
crate::t!("Undo the changes to the count boundary").into_owned(),
|
||||
crate::t!("The last change is undone; the boundary and the count area come back.").into_owned(),
|
||||
CountMsg::InvalidUndo,
|
||||
),
|
||||
action(
|
||||
crate::t!("Continue and count the entire model space").into_owned(),
|
||||
crate::t!("The count area is dropped; counting goes on in all of model space.").into_owned(),
|
||||
CountMsg::InvalidContinue,
|
||||
),
|
||||
row![
|
||||
checkbox(palette.invalid_always)
|
||||
.label(crate::t!("Always perform my current choice").into_owned())
|
||||
.text_size(12)
|
||||
.size(14)
|
||||
.on_toggle(|v| msg(CountMsg::InvalidAlways(v))),
|
||||
Space::new().width(Fill),
|
||||
crate::ui::style::form::dialog_button(crate::t!("Cancel"), msg(CountMsg::InvalidUndo), false),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
]
|
||||
.spacing(10)
|
||||
.padding([12, 14])
|
||||
.width(sizing.width)
|
||||
.into()
|
||||
}
|
||||
Reference in new issue
Block a user