Making component work better with sheets
This commit is contained in:
parent
d19ba09c6d
commit
ebefc33e3e
5 changed files with 31 additions and 9 deletions
|
|
@ -58,7 +58,24 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public override bool Persistable => ApplicationController.Instance.UserHasPermission(this);
|
||||
|
||||
public bool Finalized { get; set; } = true;
|
||||
private bool _finalizade = true;
|
||||
public bool Finalized
|
||||
{
|
||||
get => _finalizade;
|
||||
|
||||
set
|
||||
{
|
||||
_finalizade = value;
|
||||
// on any invalidate ensure that the visibility setting are correct for embedded sheet objects
|
||||
foreach (var child in this.Descendants())
|
||||
{
|
||||
if (child is SheetObject3D)
|
||||
{
|
||||
child.Visible = !this.Finalized;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> SurfacedEditors { get; set; } = new List<string>();
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
}
|
||||
|
||||
AddWebPageLinkIfRequired(context, mainContainer, theme);
|
||||
AddWebPageLinkIfRequired(context.item, mainContainer, theme);
|
||||
|
||||
// add in an Update button if applicable
|
||||
if (context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() is ShowUpdateButtonAttribute showUpdate)
|
||||
|
|
@ -1463,9 +1463,9 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return new SettingsRow("Demo Mode".Localize(), null, detailsLink, theme);
|
||||
}
|
||||
|
||||
private void AddWebPageLinkIfRequired(PPEContext context, FlowLayoutWidget editControlsContainer, ThemeConfig theme)
|
||||
public static void AddWebPageLinkIfRequired(IObject3D item, FlowLayoutWidget editControlsContainer, ThemeConfig theme)
|
||||
{
|
||||
if (context.item.GetType().GetCustomAttributes(typeof(WebPageLinkAttribute), true).FirstOrDefault() is WebPageLinkAttribute unlockLink)
|
||||
if (item.GetType().GetCustomAttributes(typeof(WebPageLinkAttribute), true).FirstOrDefault() is WebPageLinkAttribute unlockLink)
|
||||
{
|
||||
var detailsLink = new TextIconButton(unlockLink.ButtonName.Localize(), StaticData.Instance.LoadIcon("internet.png", 16, 16).SetToColor(theme.TextColor), theme)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
[HideChildrenFromTreeView]
|
||||
[HideMeterialAndColor]
|
||||
[WebPageLink("Documentation", "Open", "https://matterhackers.com/support/mattercontrol-variable-support")]
|
||||
[WebPageLink("Documentation", "Open", "https://www.matterhackers.com/support/mattercontrol-variable-support")]
|
||||
[MarkDownDescription("[BETA] - Experimental support for variables and equations with a sheets like interface.")]
|
||||
public class SheetObject3D : Object3D, IObject3DControlsProvider
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public MHTextEditWidget EditSelectedExpression { get; private set; }
|
||||
private GridWidget gridWidget;
|
||||
|
||||
public SheetEditorWidget(SheetData sheetData, UndoBuffer undoBuffer, ThemeConfig theme)
|
||||
public SheetEditorWidget(SheetData sheetData, SheetObject3D sheetObject, UndoBuffer undoBuffer, ThemeConfig theme)
|
||||
: base(FlowDirection.TopToBottom)
|
||||
{
|
||||
this.theme = theme;
|
||||
|
|
@ -125,6 +125,11 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
gridWidget.ExpandToFitContent();
|
||||
}
|
||||
|
||||
if (sheetObject != null)
|
||||
{
|
||||
PublicPropertyEditor.AddWebPageLinkIfRequired(sheetObject, this, theme);
|
||||
}
|
||||
}
|
||||
|
||||
private void ActualTextEditWidget_EditComplete1(object sender, EventArgs e)
|
||||
|
|
@ -225,7 +230,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
if (item is SheetObject3D sheetObject)
|
||||
{
|
||||
return new SheetEditorWidget(sheetObject.SheetData, undoBuffer, theme);
|
||||
return new SheetEditorWidget(sheetObject.SheetData, sheetObject, undoBuffer, theme);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
var sheetData = new SheetData(5, 5);
|
||||
var undoBuffer = new UndoBuffer();
|
||||
var theme = ApplicationController.Instance.Theme;
|
||||
var sheetEditor = new SheetEditorWidget(sheetData, undoBuffer, theme);
|
||||
var sheetEditor = new SheetEditorWidget(sheetData, null, undoBuffer, theme);
|
||||
|
||||
systemWindow.AddChild(sheetEditor);
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
var sheetData = new SheetData(5, 5);
|
||||
var undoBuffer = new UndoBuffer();
|
||||
var sheetEditorWidget = new SheetEditorWidget(sheetData, undoBuffer, theme);
|
||||
var sheetEditorWidget = new SheetEditorWidget(sheetData, null, undoBuffer, theme);
|
||||
|
||||
container.AddChild(sheetEditorWidget);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue