Пример #1
0
        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;
        }
Пример #2
0
        public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
        {
            base.CopyFrom(other, depth, mapID);
            AbstractRectangle rectangle = (AbstractRectangle)other;

            Vertices = (PointF[])rectangle.Vertices.Clone();
        }
Пример #3
0
        public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
        {
            base.CopyFrom(other, depth, mapID);
            FloatingLabel floating = (FloatingLabel)other;

            m_Offset = floating.m_Offset;
        }
Пример #4
0
        public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
        {
            SharedResource otherResource = (SharedResource)other;

            CRC      = otherResource.CRC;
            Buffer   = otherResource.Buffer;
            Filename = otherResource.Filename;
        }
Пример #5
0
        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;
        }
Пример #6
0
        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;
        }
Пример #7
0
        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();
        }
Пример #8
0
        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();
        }
Пример #9
0
        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;
        }
Пример #10
0
        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;
        }
Пример #11
0
        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;
        }
Пример #12
0
        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;
        }
Пример #13
0
 /// <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
 }
Пример #14
0
        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;
        }
Пример #15
0
        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;
                }
            }
        }
Пример #16
0
 public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
 {
     base.CopyFrom(other, depth, mapID);
     DiscardPath();
 }
Пример #17
0
 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");
 }
Пример #18
0
        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
        }
Пример #19
0
 public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID)
 {
     base.CopyFrom(other, depth, mapID);
     m_Closed = ((Pencil)other).m_Closed;
 }