Complete table creation and editing workflow

This commit is contained in:
ramox81 committed 2026-08-24 13:00:04 +03:00
1 parent 7215faae44
commit 4a08f7fe80
9 files changed
+1848 -279

No files matched your search

+47
View File
@@ -4677,6 +4677,9 @@ impl OpenCADStudio {
match self.tabs[i].scene.document.get_entity(handles[0]) {
Some(acadrust::EntityType::LwPolyline(p)) => p.vertices.len(),
Some(acadrust::EntityType::Polyline2D(p)) => p.vertices.len(),
Some(acadrust::EntityType::Table(table)) => {
table.row_count().saturating_mul(table.column_count())
}
_ => 0,
}
} else {
@@ -4688,6 +4691,7 @@ impl OpenCADStudio {
let next = (cur + delta as i64).rem_euclid(n as i64) as usize;
self.tabs[i].properties.prop_vertex = next;
self.tabs[i].properties.prop_vertex_indicator_active = next != cur as usize;
crate::entities::table::set_prop_current_cell(next);
self.refresh_properties();
}
Task::none()
@@ -4864,6 +4868,49 @@ impl OpenCADStudio {
}
return Task::none();
}
if matches!(
field.as_str(),
"tbl_cell_content_color" | "tbl_cell_background_color"
) {
let cell_index = self.tabs[i].properties.prop_vertex;
if !handles.is_empty() {
self.push_undo_snapshot(i, "TABLE CELL COLOR");
for &handle in &handles {
let Some(acadrust::EntityType::Table(table)) =
self.tabs[i].scene.document.get_entity_mut(handle)
else {
continue;
};
let columns = table.column_count();
if columns == 0 {
continue;
}
if let Some(cell) = table.cell_mut(
cell_index / columns,
cell_index % columns,
) {
let style = cell.style.get_or_insert_with(Default::default);
if field == "tbl_cell_content_color" {
style.content_color = color;
style.property_flags.insert(
acadrust::entities::table::CellStylePropertyFlags::CONTENT_COLOR,
);
} else {
style.background_color = color;
style.fill_enabled = true;
style.property_flags.insert(
acadrust::entities::table::CellStylePropertyFlags::BACKGROUND_COLOR,
);
}
}
}
self.invalidate_property_targets(i, &handles);
self.tabs[i].properties.open_color_field = None;
self.tabs[i].dirty = true;
self.refresh_properties();
}
return Task::none();
}
if !handles.is_empty() {
self.push_undo_snapshot(i, "CHPROP");
let idx = if field == "gradient_color_2" { 1 } else { 0 };