From 29bfeb23c3d0fd0bf93fc5a286766736cd1be4f2 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Sat, 20 Oct 2018 13:06:29 -0700 Subject: [PATCH] Fixing 'File' removal regressions issue: MatterHackers/MCCentral#4342 Save as not working from toolbar issue: MatterHackers/MCCentral#4343 No right click bed menu --- .../PartPreviewWindow/View3D/View3DWidget.cs | 3 --- .../PartPreviewWindow/ViewControls3D.cs | 23 ++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs index 153abb845..98c767d78 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs @@ -1336,7 +1336,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme); var actions = new[] { - WorkspaceActions["Insert"], new ActionSeparator(), new NamedAction() { @@ -1365,8 +1364,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }, IsEnabled = () => Clipboard.Instance.ContainsImage || Clipboard.Instance.GetText() == "!--IObjectSelection--!" }, - WorkspaceActions["Save"], - WorkspaceActions["SaveAs"], WorkspaceActions["Export"], new ActionSeparator(), WorkspaceActions["ArrangeAll"], diff --git a/MatterControlLib/PartPreviewWindow/ViewControls3D.cs b/MatterControlLib/PartPreviewWindow/ViewControls3D.cs index d529c80c5..74b663554 100644 --- a/MatterControlLib/PartPreviewWindow/ViewControls3D.cs +++ b/MatterControlLib/PartPreviewWindow/ViewControls3D.cs @@ -538,7 +538,28 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var saveAs = popupMenu.CreateMenuItem("Save As".Localize()); saveAs.Click += (s, e) => UiThread.RunOnIdle(() => { - this.MenuActions.FirstOrDefault(m => m.ID == "SaveAs")?.Action?.Invoke(); + UiThread.RunOnIdle(() => + { + DialogWindow.Show( + new SaveAsPage( + async (newName, destinationContainer) => + { + // Save to the destination provider + if (destinationContainer is ILibraryWritableContainer writableContainer) + { + // Wrap stream with ReadOnlyStream library item and add to container + writableContainer.Add(new[] + { + new InMemoryLibraryItem(sceneContext.Scene) + { + Name = newName + } + }); + + destinationContainer.Dispose(); + } + })); + }); }); return popupMenu;