adding in re-arrange item support
This commit is contained in:
parent
5435dd9301
commit
2597347f9c
5 changed files with 50 additions and 20 deletions
|
|
@ -209,25 +209,14 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
menuTheme.CreateMenuItems(popupMenu, actions);
|
||||
|
||||
if (selectedItem is ComponentObject3D componentObject)
|
||||
if (selectedItem is IRightClickMenuProvider menuProvider)
|
||||
{
|
||||
popupMenu.CreateSeparator();
|
||||
menuProvider.AddRightClickMenuItemsItems(popupMenu);
|
||||
}
|
||||
|
||||
string componentID = componentObject.ComponentID;
|
||||
|
||||
var helpItem = popupMenu.CreateMenuItem("Help".Localize());
|
||||
helpItem.Enabled = !string.IsNullOrEmpty(componentID) && this.HelpArticlesByID.ContainsKey(componentID);
|
||||
helpItem.Click += (s, e) =>
|
||||
{
|
||||
var helpTab = ApplicationController.Instance.ActivateHelpTab("Docs");
|
||||
if (helpTab.TabContent is HelpTreePanel helpTreePanel)
|
||||
{
|
||||
if (this.HelpArticlesByID.TryGetValue(componentID, out HelpArticle helpArticle))
|
||||
{
|
||||
helpTreePanel.ActiveNodePath = componentID;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (selectedItem.Parent is IParentRightClickMenuProvider parentMenuProvider)
|
||||
{
|
||||
parentMenuProvider.AddRightClickMenuItemsItems(popupMenu, selectedItem);
|
||||
}
|
||||
|
||||
return popupMenu;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
@ -53,4 +55,20 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
IEnumerable<EditorButtonData> GetEditorButtonsData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whene this item is right clicked it will append menu items to the right click menu
|
||||
/// </summary>
|
||||
public interface IRightClickMenuProvider
|
||||
{
|
||||
void AddRightClickMenuItemsItems(PopupMenu popupMenu);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When a child of this item is right clicked, it will add menu items
|
||||
/// </summary>
|
||||
public interface IParentRightClickMenuProvider
|
||||
{
|
||||
void AddRightClickMenuItemsItems(PopupMenu popupMenu, IObject3D itemRightClicked);
|
||||
}
|
||||
}
|
||||
|
|
@ -36,11 +36,12 @@ using MatterHackers.DataConverters3D;
|
|||
using MatterHackers.DataConverters3D.UndoCommands;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
[HideChildrenFromTreeView]
|
||||
public class ComponentObject3D : Object3D
|
||||
public class ComponentObject3D : Object3D, IRightClickMenuProvider
|
||||
{
|
||||
private const string ImageConverterComponentID = "4D9BD8DB-C544-4294-9C08-4195A409217A";
|
||||
|
||||
|
|
@ -293,5 +294,27 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRightClickMenuItemsItems(PopupMenu popupMenu)
|
||||
{
|
||||
popupMenu.CreateSeparator();
|
||||
|
||||
string componentID = this.ComponentID;
|
||||
|
||||
var helpItem = popupMenu.CreateMenuItem("Help".Localize());
|
||||
var helpArticlesByID = ApplicationController.Instance.HelpArticlesByID;
|
||||
helpItem.Enabled = !string.IsNullOrEmpty(componentID) && helpArticlesByID.ContainsKey(componentID);
|
||||
helpItem.Click += (s, e) =>
|
||||
{
|
||||
var helpTab = ApplicationController.Instance.ActivateHelpTab("Docs");
|
||||
if (helpTab.TabContent is HelpTreePanel helpTreePanel)
|
||||
{
|
||||
if (helpArticlesByID.TryGetValue(componentID, out HelpArticle helpArticle))
|
||||
{
|
||||
helpTreePanel.ActiveNodePath = componentID;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
}
|
||||
else
|
||||
{
|
||||
resultsMesh = Object3D.CombineParticipants(SourceContainer, participants, cancellationToken, reporter);
|
||||
resultsMesh = Object3D.CombineParticipants(SourceContainer, participants, cancellationToken, reporter, Processing, InputResolution, OutputResolution);
|
||||
}
|
||||
|
||||
var resultsItem = new Object3D()
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 895408eb6799d006137c9bb8824f6b950064d0eb
|
||||
Subproject commit 238b25271497943ece9ab855b119810abe2c9809
|
||||
Loading…
Add table
Add a link
Reference in a new issue