diff --git a/MatterControlLib/Library/Interfaces/LibraryExtensionMethods.cs b/MatterControlLib/Library/Interfaces/LibraryExtensionMethods.cs index 9db6c5615..c91e9a89f 100644 --- a/MatterControlLib/Library/Interfaces/LibraryExtensionMethods.cs +++ b/MatterControlLib/Library/Interfaces/LibraryExtensionMethods.cs @@ -86,8 +86,14 @@ namespace MatterHackers.MatterControl.Library // Save to the destination provider if (newContentStore is FileSystemContainer fileSystemContainer) { - sceneContext.EditContext.SourceItem = new FileSystemFileItem(Path.ChangeExtension(Path.Combine(fileSystemContainer.FullPath, newName), ".mcx")); - fileSystemContainer.Save(sceneContext.EditContext.SourceItem, sceneContext.Scene); + var fileSystemItem = new FileSystemFileItem(Path.ChangeExtension(Path.Combine(fileSystemContainer.FullPath, newName), ".mcx")); + fileSystemContainer.Save(fileSystemItem, sceneContext.Scene); + + // if it is not a printer switch to the new fileSystemItem + if (sceneContext.Printer == null) + { + sceneContext.EditContext.SourceItem = fileSystemItem; + } } else if (newContentStore is ILibraryWritableContainer writableContainer) { diff --git a/MatterControlLib/Library/Widgets/LibraryWidget.cs b/MatterControlLib/Library/Widgets/LibraryWidget.cs index c5c599f72..2b57b62d4 100644 --- a/MatterControlLib/Library/Widgets/LibraryWidget.cs +++ b/MatterControlLib/Library/Widgets/LibraryWidget.cs @@ -732,6 +732,11 @@ namespace MatterHackers.MatterControl.PrintLibrary }, IsEnabled = (selectedListItems, listView) => { + if (!OnApplicationLibraryTab()) + { + return false; + } + // Single select var only1 = listView.SelectedItems.Count == 1; // mcx only - disallow containers and protected items @@ -761,6 +766,11 @@ namespace MatterHackers.MatterControl.PrintLibrary }, IsEnabled = (selectedListItems, listView) => { + if (!OnApplicationLibraryTab()) + { + return false; + } + var isFolder = listView.SelectedItems.FirstOrDefault()?.Model is DynamicContainerLink; return listView.SelectedItems.Count == 1 @@ -798,8 +808,11 @@ namespace MatterHackers.MatterControl.PrintLibrary activeContext.SceneContext.AddToPlate(selectedLibraryItems); } - ApplicationController.Instance.BlinkTab( - ApplicationController.Instance.MainView.TabControl.AllTabs.FirstOrDefault(t => t.TabContent is DesignTabPage)); + if (OnApplicationLibraryTab()) + { + ApplicationController.Instance.BlinkTab( + ApplicationController.Instance.MainView.TabControl.AllTabs.FirstOrDefault(t => t.TabContent is DesignTabPage)); + } }, IsEnabled = (selectedListItems, listView) => { @@ -1041,6 +1054,16 @@ namespace MatterHackers.MatterControl.PrintLibrary libraryView.MenuActions = menuActions; } + private static bool OnApplicationLibraryTab() + { + if (ApplicationController.Instance.MainTabKey == "Library") + { + return true; + } + + return false; + } + public override void OnClosed(EventArgs e) { // Unregister listeners diff --git a/MatterControlLib/PartPreviewWindow/ViewToolBarControls.cs b/MatterControlLib/PartPreviewWindow/ViewToolBarControls.cs index b0e666402..056bf3f81 100644 --- a/MatterControlLib/PartPreviewWindow/ViewToolBarControls.cs +++ b/MatterControlLib/PartPreviewWindow/ViewToolBarControls.cs @@ -647,7 +647,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var openMenuItems = new PopupMenu(ApplicationController.Instance.MenuTheme); popupMenu.PopupContent = openMenuItems; - var openFileButton = openMenuItems.CreateMenuItem("Open File".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor)); + var openFileButton = openMenuItems.CreateMenuItem("Add File to Bed".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor)); openFileButton.Click += (s, e) => { @@ -716,7 +716,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var openColor = theme.ResolveColor(theme.BackgroundColor, theme.SlightShade); PopupMenuButton libraryPopup = null; - libraryPopup = new PopupMenuButton("Open".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme) + libraryPopup = new PopupMenuButton("Add to Bed".Localize(), StaticData.Instance.LoadIcon("fa-folder-open_16.png", 16, 16).SetToColor(theme.TextColor), theme) { MakeScrollable = false, Name = "Add Content Menu", diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index a84332916..1e8823031 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -208,6 +208,9 @@ Translated:Add an.stl, .obj, .amf, .gcode or.zip file to the Library English:Add Base Translated:Add Base +English:Add File to Bed +Translated:Add File to Bed + English:Add Hook Translated:Add Hook