fix(ribbon): load style/layer dropdowns from the document

The Annotate style dropdowns (text / dimension / multileader / table) and
the layer dropdown were hard-coded to "Standard" / "0" and never synced
from the opened document, so they showed placeholder values even with no
file open and stale values after closing one.

- Start the ribbon's style and layer lists empty instead of with a
  placeholder entry.
- Sync the style dropdowns from the document on file open and on tab
  new/switch/close (the layer sync already ran there).
- Guard sync_ribbon_layers / sync_ribbon_styles / sync_ribbon_from_selection
  for the Start (welcome) tab so all three dropdowns stay empty there.
- When a style family is absent (e.g. no table/multileader styles), fall
  back to empty rather than a non-existent "Standard".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-12 01:46:17 +03:00
1 parent 2519d64907
commit b47e1bf706
4 files changed
+46 -21

No files matched your search

+6
View File
@@ -325,6 +325,12 @@ impl OpenCADStudio {
/// marker to do better).
pub(super) fn sync_ribbon_from_selection(&mut self) {
let i = self.active_tab;
// The Start (welcome) tab has no document — keep the ribbon's
// current-layer chip empty rather than re-seeding it with a default.
if self.tabs[i].is_start {
self.ribbon.active_layer = String::new();
return;
}
let selected = self.tabs[i].scene.selected_entities();
if selected.is_empty() {
// Creation defaults: prefer the file's saved CECOLOR / CELTYPE /