mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-05 03:31:35 -05:00
fix(ui): keep the drawing library dialogs above the main window
The library dialogs were owned by the nest tab (an MDI child) or by the library view, both child windows. Windows only keeps a dialog above its owner, so the main window could cover them. Own them by the top-level window instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4dae54c629
commit
440fe767f1
2 files changed
+21
-9
No files matched your search
@@ -100,6 +100,12 @@ namespace OpenNest.Controls
|
||||
/// </summary>
|
||||
public bool QuantitiesChanged { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The window that owns this view's dialogs. A dialog owned by a child control is not kept
|
||||
/// above its top-level window, so it can fall behind it.
|
||||
/// </summary>
|
||||
private IWin32Window DialogOwner => (IWin32Window)TopLevelControl ?? this;
|
||||
|
||||
public DrawingLibraryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -126,24 +132,24 @@ namespace OpenNest.Controls
|
||||
EditDrawing = edit =>
|
||||
{
|
||||
using var form = new EditLibraryDrawingForm(edit);
|
||||
return form.ShowDialog(this) == DialogResult.OK ? form.Saved : null;
|
||||
return form.ShowDialog(DialogOwner) == DialogResult.OK ? form.Saved : null;
|
||||
};
|
||||
ChooseSet = () =>
|
||||
{
|
||||
using var form = new ChooseDrawingSetForm(sets, library, this.serverUrl);
|
||||
return form.ShowDialog(this) == DialogResult.OK ? (true, form.PickedSet) : (false, null);
|
||||
return form.ShowDialog(DialogOwner) == DialogResult.OK ? (true, form.PickedSet) : (false, null);
|
||||
};
|
||||
EditSet = edit =>
|
||||
{
|
||||
using var form = new EditDrawingSetForm(edit, library, this.serverUrl);
|
||||
return form.ShowDialog(this) == DialogResult.OK ? form.Saved : null;
|
||||
return form.ShowDialog(DialogOwner) == DialogResult.OK ? form.Saved : null;
|
||||
};
|
||||
ShowReleases = record =>
|
||||
{
|
||||
using var form = new DrawingSetsForm(sets, library, this.serverUrl);
|
||||
enableSetsRelease(form);
|
||||
_ = form.ShowReleasesAsync(drawing: record);
|
||||
form.ShowDialog(this);
|
||||
form.ShowDialog(DialogOwner);
|
||||
};
|
||||
LoadPreview = async (record, token) =>
|
||||
{
|
||||
@@ -437,7 +443,7 @@ namespace OpenNest.Controls
|
||||
using var form = new ReleaseSetForm(sets, library, nests, serverUrl, Array.Empty<DrawingSetRecord>(),
|
||||
new[] { new SetReleaseDrawingLine(record, quantity) }, openNest)
|
||||
{ IsNestOpen = isNestOpen ?? (_ => false) };
|
||||
form.ShowDialog(this);
|
||||
form.ShowDialog(DialogOwner);
|
||||
};
|
||||
enableSetsRelease = form => form.EnableRelease(nests, openNest, isNestOpen);
|
||||
releaseSeparator.Visible = true;
|
||||
|
||||
@@ -1177,7 +1177,7 @@ namespace OpenNest.Forms
|
||||
PlateView.EndAction();
|
||||
cutSimulatorForm = new CutSimulatorForm(this);
|
||||
cutSimulatorForm.FormClosed += (_, _) => cutSimulatorForm = null;
|
||||
var owner = MdiParent ?? (Form)this;
|
||||
var owner = DialogOwner;
|
||||
var corner = owner.PointToScreen(new Point(owner.ClientSize.Width, owner.ClientSize.Height));
|
||||
cutSimulatorForm.Show(owner);
|
||||
cutSimulatorForm.Location = new Point(
|
||||
@@ -1457,6 +1457,12 @@ namespace OpenNest.Forms
|
||||
drawingListBox1.SaveToLibraryUnavailableReason = enabled ? null : NestStorage.DatabaseModeOnly;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The top-level window that owns this tab's dialogs. An MDI child is a child window, and a
|
||||
/// dialog owned by one is not kept above the main window, so it can fall behind it.
|
||||
/// </summary>
|
||||
private Form DialogOwner => MdiParent ?? this;
|
||||
|
||||
/// <summary>Opens the drawing library browser and lists whatever it added.</summary>
|
||||
public void AddFromDrawingLibrary()
|
||||
{
|
||||
@@ -1483,7 +1489,7 @@ namespace OpenNest.Forms
|
||||
// The dialog adds drawings and sets quantities as the operator works in it.
|
||||
using var change = BeginChange("Drawing Library");
|
||||
var job = (Nest.Material, Nest.Thickness);
|
||||
form.ShowDialog(this);
|
||||
form.ShowDialog(DialogOwner);
|
||||
if (form.AddedDrawings.Count > 0 || form.QuantitiesChanged)
|
||||
{
|
||||
change.MarkChanged();
|
||||
@@ -1531,7 +1537,7 @@ namespace OpenNest.Forms
|
||||
lastCutType, Environment.UserName);
|
||||
// The library itself is on the server; the drawing's link to it is saved with the nest.
|
||||
using var change = BeginChange("Save to Drawing Library");
|
||||
if (form.ShowDialog(this) != DialogResult.OK || form.Result == null)
|
||||
if (form.ShowDialog(DialogOwner) != DialogResult.OK || form.Result == null)
|
||||
{
|
||||
change.Complete();
|
||||
return;
|
||||
@@ -1574,7 +1580,7 @@ namespace OpenNest.Forms
|
||||
addingToSet = true;
|
||||
try
|
||||
{
|
||||
await new NestDrawingsToSet(this, sets, library, NestStorage.Settings.ServerUrl).RunAsync(Nest);
|
||||
await new NestDrawingsToSet(DialogOwner, sets, library, NestStorage.Settings.ServerUrl).RunAsync(Nest);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user