public void UnExecute() { InstanceGroup sel = MainForm.CurrentStage.Selection; sel.Set(prevSelected); MainForm.CurrentStage.ResetTransformHandles(); }
public void UnExecute() { StageView stage = MainForm.CurrentStage; InstanceGroup sel = stage.Selection; stage.RemoveInstancesById(instanceIds); sel.Set(prevSelected); stage.ResetTransformHandles(); stage.InvalidateTransformedSelection(); }
public void Execute() { InstanceGroup sel = MainForm.CurrentStage.Selection; prevSelected = sel.SelectedIds; if (modifier == SelectionModifier.AddToSelection) { uint[] allSelected = prevSelected.Union(instanceIds).ToArray <uint>(); sel.Set(allSelected); } else if (modifier == SelectionModifier.SubtractFromSelection) { uint[] allSelected = prevSelected.Except(instanceIds).ToArray <uint>(); sel.Set(allSelected); } else { sel.Set(instanceIds); MainForm.CurrentStage.ResetTransformHandles(); } }
public void UnExecute() { StageView stage = MainForm.CurrentStage; //DDW.Display.DesignTimeline curEditItem = stage.CurrentEditItem; InstanceGroup sel = stage.Selection; stage.RemoveInstancesById(newInstances); for (int i = 0; i < prevInstances.Length; i++) { stage.InsertExistingInstance(prevDepths[i], MainForm.CurrentInstanceManager[prevInstances[i]]); } sel.Set(prevSelection); stage.ResetTransformHandles(); stage.InvalidateSelection(); }
public void Execute() { StageView stage = MainForm.CurrentStage; InstanceGroup sel = stage.Selection; prevSelected = sel.SelectedIds; if (instanceIds == null) { instanceIds = stage.AddInstances(libraryIds, locations); } else { stage.AddInstancesById(instanceIds); } sel.Set(instanceIds); stage.ResetTransformHandles(); stage.InvalidateTransformedSelection(); }
public void Execute() { StageView stage = MainForm.CurrentStage; InstanceGroup sel = stage.Selection; this.prevSelected = sel.SelectedIds; Vex.Point selRotCent = sel.GlobalRotationCenter.Translate(sel.Location.Negate()); uint[] libraryIds = new uint[prevSelected.Length]; Vex.Point[] locations = new Vex.Point[prevSelected.Length]; for (int i = 0; i < prevSelected.Length; i++) { DesignInstance di = MainForm.CurrentInstanceManager[prevSelected[i]]; libraryIds[i] = di.LibraryItem.DefinitionId; locations[i] = new Vex.Point(di.Location.X + offset.X, di.Location.Y + offset.Y); } if (newInstanceIds == null) { newInstanceIds = stage.AddInstances(libraryIds, locations); for (int i = 0; i < newInstanceIds.Length; i++) { DesignInstance oldDi = MainForm.CurrentInstanceManager[prevSelected[i]]; DesignInstance newDi = MainForm.CurrentInstanceManager[newInstanceIds[i]]; Vex.Matrix m = oldDi.GetMatrix(); stage.SetDesignInstanceMatrix(newDi, new Vex.Matrix(m.ScaleX, m.Rotate0, m.Rotate1, m.ScaleY, newDi.Location.X, newDi.Location.Y)); newDi.RotationCenter = oldDi.RotationCenter; } } else { stage.AddInstancesById(newInstanceIds); } sel.Set(newInstanceIds); sel.GlobalRotationCenter = selRotCent.Translate(sel.Location); stage.ResetTransformHandles(); stage.InvalidateTransformedSelection(); }
public void Execute() { StageView stage = MainForm.CurrentStage; InstanceGroup sel = stage.Selection; InstanceManager instMgr = stage.InstanceManager; prevSelection = sel.IdsByDepth; List <uint> addedInstances = new List <uint>(); List <uint> newSelection = new List <uint>(); List <uint> toBreakApart = new List <uint>(); List <int> originalDepths = new List <int>(); for (int i = 0; i < prevSelection.Length; i++) { DesignInstance di = instMgr[prevSelection[i]]; if (CanBreakApart(di)) { toBreakApart.Add(prevSelection[i]); originalDepths.Add(di.Depth); } else { newSelection.Add(prevSelection[i]); } } prevInstances = toBreakApart.ToArray(); prevDepths = originalDepths.ToArray(); sel.Clear(); for (int i = 0; i < toBreakApart.Count; i++) { uint id = toBreakApart[i]; DesignInstance di = instMgr[id]; int orgDepth = di.Depth; Matrix orgMatrix = di.GetSysMatrix(); Vex.Point offset = di.Location; uint[] instances = ((DesignTimeline)di).InstanceIds; for (int j = instances.Length - 1; j >= 0; j--) { DesignInstance orgInstance = instMgr[instances[j]]; uint subLibId = orgInstance.LibraryItem.DefinitionId; DesignInstance inst = stage.AddInstance(subLibId, Vex.Point.Zero); stage.CurrentEditItem.ChangeDepth(inst.Depth, orgDepth); using (Matrix m = orgInstance.GetSysMatrix().Clone()) { m.Multiply(orgMatrix, MatrixOrder.Append); stage.SetDesignInstanceMatrix(inst, m.VexMatrix()); } addedInstances.Add(inst.InstanceHash); newSelection.Add(inst.InstanceHash); } stage.RemoveInstancesById(new uint[] { id }); } newInstances = addedInstances.ToArray(); sel.Set(newSelection.ToArray()); stage.ResetTransformHandles(); }