From 3f5d402489f8c6156bb60415a52a7f1501e2ef41 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 24 Oct 2026 16:09:46 -0400 Subject: [PATCH] feat(desktop): open the Drawing Sets window as a maximized MDI child File > Drawing Library, Drawing Sets, Releases and database-mode Import BOM now open the window inside the main form, maximized, instead of as a modal dialog. A second menu click activates the open window on the tab asked for. Close now closes the window, since a DialogResult button no longer does outside a modal dialog. Co-Authored-By: Claude Opus 5.5 --- OpenNest/Forms/DrawingSetsForm.cs | 12 ++++++++++-- OpenNest/Forms/MainForm.File.cs | 23 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/OpenNest/Forms/DrawingSetsForm.cs b/OpenNest/Forms/DrawingSetsForm.cs index ec93a091..1686a8aa 100644 --- a/OpenNest/Forms/DrawingSetsForm.cs +++ b/OpenNest/Forms/DrawingSetsForm.cs @@ -43,6 +43,8 @@ namespace OpenNest.Forms libraryView.ShowReleases = drawing => _ = ShowReleasesAsync(drawing: drawing); releasesView.Initialize(sets); Text = $"Drawing Library — {serverUrl}"; + // Shown as an MDI child, where a DialogResult button no longer closes the window. + closeButton.Click += (_, _) => Close(); } /// @@ -84,6 +86,13 @@ namespace OpenNest.Forms /// public bool ImportBomWhenShown { get; set; } + /// Switches to the Sets tab and opens Import BOM on it. + public Task ImportBomAsync() + { + ShowSets(); + return browser.ImportBomAsync(); + } + private async void DrawingSetsForm_Shown(object sender, EventArgs e) { shown = true; @@ -91,8 +100,7 @@ namespace OpenNest.Forms if (ImportBomWhenShown && !IsDisposed) { ImportBomWhenShown = false; - ShowSets(); - await browser.ImportBomAsync(); + await ImportBomAsync(); } } diff --git a/OpenNest/Forms/MainForm.File.cs b/OpenNest/Forms/MainForm.File.cs index dd02e6a9..174ae0ba 100644 --- a/OpenNest/Forms/MainForm.File.cs +++ b/OpenNest/Forms/MainForm.File.cs @@ -143,6 +143,22 @@ namespace OpenNest.Forms if (!NestStorage.Settings.IsDatabaseMode) return; + // One Drawing Sets window at a time: a second menu click brings it forward on the tab asked for. + var open = MdiChildren.OfType().FirstOrDefault(); + if (open != null) + { + open.Activate(); + if (releases) + _ = open.ShowReleasesAsync(); + else if (libraryTab) + open.ShowLibrary(); + else if (importBom) + _ = open.ImportBomAsync(); + else + open.ShowSets(); + return; + } + IDrawingLibraryStore library; IDrawingSetStore sets; INestRepository nests; @@ -158,14 +174,17 @@ namespace OpenNest.Forms return; } - using var form = new DrawingSetsForm(sets, library, NestStorage.Settings.ServerUrl); + // An MDI child beside the nest tabs, maximized when it opens; disposed when closed. + var form = new DrawingSetsForm(sets, library, NestStorage.Settings.ServerUrl); form.EnableRelease(nests, OpenServerNest, IsServerNestOpen); if (releases) _ = form.ShowReleasesAsync(); else if (libraryTab) form.ShowLibrary(); form.ImportBomWhenShown = importBom; - form.ShowDialog(this); + form.MdiParent = this; + form.WindowState = FormWindowState.Maximized; + form.Show(); } private async void Save_Click(object sender, EventArgs e)