Simplify
This commit is contained in:
parent
a82564b383
commit
b90c082b08
9 changed files with 15 additions and 15 deletions
|
|
@ -597,7 +597,7 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
});
|
||||
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(selectedItem.Children.ToList(), new List<IObject3D> { newGroup }));
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(selectedItem.Children.ToList(), new[] { newGroup }));
|
||||
|
||||
newGroup.MakeNameNonColliding();
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ namespace MatterHackers.MatterControl
|
|||
var fit = FitToBoundsObject3D_2.Create(selectedItem.Clone());
|
||||
fit.MakeNameNonColliding();
|
||||
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { selectedItem }, new List<IObject3D> { fit }));
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new[] { selectedItem }, new[] { fit }));
|
||||
scene.SelectedItem = fit;
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("fit.png", 16, 16, theme.InvertIcons),
|
||||
|
|
@ -1296,9 +1296,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// Copy an selected item into the component as a clone
|
||||
component.Children.Modify(children =>
|
||||
{
|
||||
children.AddRange(items.Select(o => o.Clone()));
|
||||
});
|
||||
{
|
||||
children.AddRange(items.Select(o => o.Clone()));
|
||||
});
|
||||
|
||||
component.MakeNameNonColliding();
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
meshOnlyItem.CopyProperties(this, Object3DPropertyFlags.All);
|
||||
|
||||
// and replace us with the children
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { this }, new List<IObject3D> { meshOnlyItem }));
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new[] { this }, new[] { meshOnlyItem }));
|
||||
}
|
||||
|
||||
Invalidate(new InvalidateArgs(this, InvalidateType.Content));
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
scene.UndoBuffer.AddAndDo(
|
||||
new ReplaceCommand(
|
||||
itemsToReplace,
|
||||
new List<IObject3D> { newParent }));
|
||||
new[] { newParent }));
|
||||
|
||||
var topParent = newParent.Parents<IObject3D>().LastOrDefault((i) => i.Parent != null);
|
||||
UiThread.RunOnIdle(() =>
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
IObject3D replaceItem = item.Clone();
|
||||
firstChild.Children.Add(replaceItem);
|
||||
var replace = new ReplaceCommand(new List<IObject3D> { item }, new List<IObject3D> { this });
|
||||
var replace = new ReplaceCommand(new[] { item }, new[] { this });
|
||||
undoBuffer.AddAndDo(replace);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
newChildren.Add(meshOnlyItem);
|
||||
}
|
||||
|
||||
if(newChildren.Count > 1)
|
||||
if (newChildren.Count > 1)
|
||||
{
|
||||
var group = new GroupObject3D();
|
||||
group.Name = this.Name;
|
||||
|
|
@ -84,13 +84,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
newChildren.Clear();
|
||||
newChildren.Add(group);
|
||||
}
|
||||
else if(newChildren.Count == 1)
|
||||
else if (newChildren.Count == 1)
|
||||
{
|
||||
newChildren[0].Name = this.Name;
|
||||
}
|
||||
|
||||
// and replace us with the children
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { this }, newChildren));
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new[] { this }, newChildren));
|
||||
}
|
||||
|
||||
Invalidate(new InvalidateArgs(this, InvalidateType.Content, undoBuffer));
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
newContainer.Children.Add(child.Clone());
|
||||
}
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { this }, new List<IObject3D> { newContainer }));
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new[] { this }, new[] { newContainer }));
|
||||
}
|
||||
|
||||
public override async void OnInvalidate(InvalidateArgs invalidateType)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
newContainer.Children.Add(child.Clone());
|
||||
}
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { this }, new List<IObject3D> { newContainer }));
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new[] { this }, new[] { newContainer }));
|
||||
}
|
||||
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
// collapse our children into our parent
|
||||
// and replace us with the children
|
||||
var replaceCommand = new ReplaceCommand(new List<IObject3D> { this }, thisClone.Children.ToList());
|
||||
var replaceCommand = new ReplaceCommand(new[] { this }, thisClone.Children.ToList());
|
||||
if (undoBuffer != null)
|
||||
{
|
||||
undoBuffer.AddAndDo(replaceCommand);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
// add and do the undo data
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { selectedItem }, addItems));
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new[] { selectedItem }, addItems));
|
||||
|
||||
foreach (var item in addItems)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue