fix(menu): wire EXIT / QUIT commands to the close path (#41)

The OCS main menu's "Exit Open CAD Studio" button dispatched
`Message::Command("EXIT")` but `dispatch_command` had no arm for it,
so the click was swallowed. Route `EXIT` and `QUIT` through
`Message::WindowCloseRequested` so the unsaved-changes dialog runs
first and the app then exits via the same path as the OS-window close.

Closes #41

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-05-28 22:55:08 +03:00
1 parent 269e21cbfb
commit e27ab79b08
1 file changed
+9
+9
View File
@@ -32,6 +32,15 @@ impl OpenCADStudio {
"CLEAR" | "CLR" => return Task::done(Message::ClearScene),
"WIREFRAME" | "VW" => return Task::done(Message::SetWireframe(true)),
"SOLID" | "VS" => return Task::done(Message::SetWireframe(false)),
"EXIT" | "QUIT" => {
// Funnel through the OS close path so the unsaved-changes
// dialog runs before `iced::exit()`. Falls back to a hard
// exit if there's no main window registered yet.
if let Some(id) = self.main_window {
return Task::done(Message::WindowCloseRequested(id));
}
return iced::exit();
}
// ── Background color ───────────────────────────────────────────
// Usage: BACKGROUND <r> <g> <b> (0–255 each)