Made update button work better on subtract

This commit is contained in:
Lars Brubaker 2018-01-12 09:40:52 -08:00
parent 834d973ff0
commit 7f9ca45fc9
3 changed files with 29 additions and 9 deletions

View file

@ -88,10 +88,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
{
// make sure the mesh on the group is not visible
group.ResetMeshWrappers();
updateButton.Enabled = false;
ProcessBooleans(group);
};
int checkedCount = 0;
List<GuiWidget> radioSiblings = new List<GuiWidget>();
for (int i = 0; i < children.Count; i++)
{
@ -141,10 +141,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
};
tabContainer.AddChild(rowContainer);
checkedCount += checkBox.Checked ? 1 : 0;
}
if (checkedCount == 0) // no items selected
bool opperationApplied = group.Descendants()
.Where((obj) => obj.OwnerID == group.ID)
.Where((objId) => objId.Mesh != objId.Children.First().Mesh).Count() > 0;
bool selectionHasBeenMade = group.Descendants()
.Where((obj) => obj.OwnerID == group.ID)
.Where((objId) => objId.OutputType == PrintOutputTypes.Hole).Count() > 0;
if (!opperationApplied && !selectionHasBeenMade)
{
// select the last item
if (tabContainer.Decendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox)
@ -152,6 +159,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
firstCheckBox.Checked = true;
}
}
else
{
updateButton.Enabled = !opperationApplied;
}
// add this last so it is at the bottom
tabContainer.AddChild(updateButton);