public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Group otherGroup = (Group)other; if (depth == CopyDepth.Transform && Contents.Count == otherGroup.Contents.Count) { // excludes first time -when we must clone the shapes to get new copies to store the differing coords for (int index = 0; index <= Contents.Count - 1; index++) { Contents[index].CopyFrom(otherGroup.Contents[index], depth, mapID); } } else { // undo requires all shapes are copied, because they could later be edited by styling changes Contents.Clear(); if (mapID == null) { mapID = Mapping.Ignore; } foreach (Shape shape in otherGroup.Contents) { Shape create = (Shape)shape.Clone(mapID); create.Parent = this; Contents.Add(create); } } m_Sockets = null; m_Bounds = RectangleF.Empty; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); AbstractRectangle rectangle = (AbstractRectangle)other; Vertices = (PointF[])rectangle.Vertices.Clone(); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); FloatingLabel floating = (FloatingLabel)other; m_Offset = floating.m_Offset; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { SharedResource otherResource = (SharedResource)other; CRC = otherResource.CRC; Buffer = otherResource.Buffer; Filename = otherResource.Filename; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Polygon polygon = (Polygon)other; m_Sides = polygon.m_Sides; m_Acceptable = polygon.m_Acceptable; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); FreeText freeText = (FreeText)other; m_StartPoint = freeText.m_StartPoint; m_Bounds = freeText.m_Bounds; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); TextLine textLine = (TextLine)other; Vertices[0] = textLine.Vertices[0]; Vertices[1] = textLine.Vertices[1]; ClearTextCache(); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Curve objCurve = (Curve)other; // these need to be copied for transformations, even though they can be derived and so aren't completely essential for undo m_ControlPoints.Clear(); m_ControlPoints.AddRange(objCurve.m_ControlPoints); DiscardDerived(); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); UserSocket socket = (UserSocket)other; m_Centre = socket.m_Centre; m_Exit = socket.m_Exit; Options = socket.Options; Classification = socket.Classification; m_Bounds = RectangleF.Empty; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); SharedImage sharedImage = (SharedImage)other; if (depth >= CopyDepth.Duplicate) { m_Image = sharedImage.m_Image?.Clone(); CRC = sharedImage.CRC; } m_ResourceName = sharedImage.m_ResourceName; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); ImportedImage imported = (ImportedImage)other; m_Bounds = imported.m_Bounds; m_Flip = imported.m_Flip; m_PositionFixed = imported.m_PositionFixed; m_SizeAcceptable = imported.m_SizeAcceptable; // image data never needs to be duplicated, it is always shared m_Data = imported.m_Data?.Clone(); m_ImageSize = imported.m_ImageSize; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Paper objPaper = (Paper)other; PaperType = objPaper.PaperType; GridColour = objPaper.GridColour; X = objPaper.X; Y = objPaper.Y; GraphMultiple = objPaper.GraphMultiple; m_Dotted = objPaper.m_Dotted; GridVisible = objPaper.GridVisible; DotSize = objPaper.DotSize; }
/// <summary>ID is never copied Undo will never restore it either, and when cloning we want a different ID /// mapID is defined __if and only if__ eDepth = Duplicate</summary> /// <param name="depth"></param> /// <param name="mapID">if duplicating, the ID mapping for any sub objects should be added to that list</param> /// <param name="other"></param> public virtual void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { Debug.Assert((depth == CopyDepth.Duplicate) == (mapID != null)); if (other == this) { Debug.Assert(other != this); } // will fail in various places in shapes (where it clears my list and copies the contents of the other list) // if this data object contains or references other _data_ objects it should just copy the reference. for undo/redo changes to the other object will be applied separately // if this data object contains other objects which do not derive from Datum, it should make a deep copy of those, so that both copies of this Datum // operate independently. This includes lists of other Datum - it must make a copy of the list, rather than copying the list reference, but the list can // then contain links to the original objects. // Some transient information, such as list of selected shapes within a page need not be copied (? Maybe change this to maintain selection on undo?) // the second parameter can allow a partial copy, especially when all we are doing is backing up the coordinates }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); MaskedImage mask = (MaskedImage)other; // largely copied fom scriptable Debug.Assert((Image == null) == (MaskShape == null)); if (depth == CopyDepth.Transform && MaskShape != null) // m_Mask and m_Image will either both be null or neither { // first time must copy reference, below if (MaskShape != mask.MaskShape) { MaskShape?.CopyFrom(mask.MaskShape, depth, mapID); } if (Image != mask.Image) { Image?.CopyFrom(mask.Image, depth, mapID); } } else // if (depth == CopyDepth.Duplicate) { if (mapID?.ContainsKey(mask.MaskShape.ID) ?? false) { MaskShape = (Lined)mapID[mask.MaskShape.ID]; } else { MaskShape = (Lined)mask.MaskShape.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore } MaskShape.Parent = this; if (mapID?.ContainsKey(mask.Image.ID) ?? false) { Image = (ImportedImage)mapID[mask.Image.ID]; } else { Image = (ImportedImage)mask.Image.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore } Image.Parent = this; } m_Bounds = RectangleF.Empty; }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Filled filled = (Filled)other; if (depth >= CopyDepth.Undo) { if (FillStyle == null || FillStyle == filled.FillStyle) { FillStyle = new FillStyleC(); } FillStyle.CopyFrom(filled.FillStyle); } else { if (FillStyle == null) { FillStyle = filled.FillStyle; } } }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); DiscardPath(); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Debug.Fail("there is no reason to be using SelectionBox.CopyFrom"); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { // this is slightly flaky for Undo still, in that the scriptable must be put into the transaction FIRST // (otherwise it will refernce differing copies of the contained element) base.CopyFrom(other, depth, mapID); Scriptable scriptable = (Scriptable)other; if (depth > CopyDepth.Transform) { CopyPresentationFrom(scriptable, false); } //Debug.WriteLine("Scriptable.CopyFrom, depth=" + depth + " ID=" + scriptable.SAWID); // contained element. Works like ShapeStack containment - Element is tightly bound within this if (depth == CopyDepth.Transform && Element != null) { // first time must copy reference, below if (Element != scriptable.Element) { Element?.CopyFrom(scriptable.Element, depth, mapID); } } else // if (depth == CopyDepth.Duplicate) { if (mapID?.ContainsKey(scriptable.Element.ID) ?? false) { Element = (Shape)mapID[scriptable.Element.ID]; } else { Element = (Shape)scriptable.Element.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore } Element.Parent = this; } //else //{ // Element = scriptable.Element; //} ////else if (depth == CopyDepth.Duplicate) ////{ //// if (mapID == null) //// mapID = Mapping.Ignore; //// Element = (Shape)scriptable.Element.Clone(mapID); //// Element.Parent = this; ////} //else //{ // // undo requires all shapes are copied, because they could later be edited by styling changes // //Element = Shape.CreateShape(scriptable.Element.ShapeCode); // <- this is inadequate as it doesn't clone contents of the items which leaves some reference problems // //Element.CopyFrom(scriptable.Element, depth, null); // Element = (Shape)scriptable.Element.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore // Element.Parent = this; //} // other fields: if (depth > CopyDepth.Transform) { SAWID = scriptable.SAWID; Popup = scriptable.Popup; Shown = scriptable.Shown; AutoRepeat = scriptable.AutoRepeat; RepeatTimeout = scriptable.RepeatTimeout; for (int i = 0; i < Scripts.Length; i++) { Scripts[i] = scriptable.Scripts[i]?.Clone(); } } m_Bounds = RectangleF.Empty; // because content may have moved - especially on Undo }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); m_Closed = ((Pencil)other).m_Closed; }