Improving library item menus
This commit is contained in:
parent
78b56d0b32
commit
e19620dfc7
4 changed files with 38 additions and 6 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue