feat(ui): unified modal dispatch; migrate 4 dialogs (Plan B)

Replace the per-dialog open flag with a single `active_modal:
Option<ModalKind>` and one `CloseModal` message. view_main matches it to
render the open dialog as an in-canvas modal.

Migrated off OS windows: About (content-sized), Shortcuts, Plugin
Manager and the Update notice (the latter three keep a bounded size via
a wrapping container, since their lists/scroll need defined bounds).

Native + web build; 75 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-16 19:07:25 +03:00
commit 6a3663b3f1
3 changed files with 70 additions and 70 deletions

View file

@ -294,8 +294,9 @@ pub(super) struct OpenCADStudio {
color_pick_target: Option<ColorPickTarget>,
shortcuts_window: Option<window::Id>,
about_window: Option<window::Id>,
/// In-canvas About modal (Plan B: shared overlay instead of an OS window).
about_open: bool,
/// The open in-canvas modal dialog, if any (Plan B: shared overlay instead
/// of OS windows).
active_modal: Option<ModalKind>,
plugin_manager_window: Option<window::Id>,
/// New-release notification window — opened on startup when the
/// GitHub releases API reports a newer version than this build.
@ -587,6 +588,17 @@ pub enum ColorPickTarget {
Layer(usize),
}
/// Which in-canvas modal dialog is currently open (Plan B). At most one shows
/// at a time; dialog-specific data lives in its own fields. Closed via the
/// modal's ✕ (`Message::CloseModal`).
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum ModalKind {
About,
Shortcuts,
PluginManager,
UpdateNotice,
}
/// Identifies a DimStyle field that can be edited in the dialog.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DsField {
@ -994,7 +1006,8 @@ pub enum Message {
ShortcutsPanelClose,
// ── About window ────────────────────────────────────────────────────
AboutOpen,
AboutClose,
/// Close whatever in-canvas modal dialog is open (Plan B).
CloseModal,
AboutCopyInfo,
// ── Plugin Manager window ───────────────────────────────────────────
PluginManagerOpen,
@ -1416,7 +1429,7 @@ impl OpenCADStudio {
color_pick_target: None,
shortcuts_window: None,
about_window: None,
about_open: false,
active_modal: None,
plugin_manager_window: None,
update_notice_window: None,
assoc_prompt_window: None,